I have a lot of input fields in a form. One of which is
<input type="text" name="client_openingbalance"
[(ngModel)]="client.openingbalance" class="form-control">
Using jQuery I am modifying the value of this input field
$('.validateForm').on('keypress focusout paste','input',function(event){
event.target.value = 100;
});
But unfortunately, this change is not reflected in client.openingbalance. Now, to achieve this I tried to add following lines of code.
$('.validateForm').on('keypress focusout paste','input',function(event){
event.target.value = 100;
$(this).trigger('click');
});
But is still not triggering ngModel. I cannot go and write code for every field.
Help would be appreciated.
答案 0 :(得分:0)
试试这样:
$('.validateForm input').on('keypress focusout paste',function(event){
event.target.value = 100;
});
该事件将触发input
内的每个.validateForm
。
让我知道