Published:
September 10, 2020Jquery set input value and trigger on blur event
I want to trigger an event every time i click on select on any element by id
First i will try to set the input value by the following code
pickedvalue = jQuery(‘#someElementId’).val();
jQuery(‘#anotherInputElement’).val(parseInt(pickedvalue)); // use parseInt if the input type is “number” else not required.
After setting the new value to the other element i wanted to fire “on blur” event so to achieve the same use the below code.
jQuery(‘#anotherInputElement’).val(parseInt(pickedvalue)).trigger(“change”).blur();
–Happy Coding