Blog Image

Jquery 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



Author: admin

Vinod Ram has been in Software Industry since 2006 and has experience of over 16 years in Software Development & Project Management domain specialised majorly in LAMP stack & Open Source Technology, building enterprise level Web based Application, Large Database driven and huge traffic Websites and Project Management. He loves to write information articles and blog to share his knowledge and experience with the outside world and help people to find solution for their problems.