Changes in value of hidden input elements don’t automatically fire the .change() event. So, whenever you set the value of any hidden input element & want the change to be tracked, you explicitly have to tell jQuery to trigger change event on that hidden input element.
function changeStatus(statusValue) {
$('#status').val(statusValue).trigger('change');
}
…. and then …
$('#status').change(function(){
... Perform some function on change of value ...
})
Author: Makarand Thengdi
Director of Engineering, DevOps, and Releases at LeadSquared, with over a decade of experience in leading engineering and DevOps transformations for high-growth companies. Passionate about optimizing software delivery pipelines, cloud infrastructure, and security compliance. In this blog, I share my learnings and insights on DevOps, cloud technologies, and modern software engineering, reflecting my journey from code to cloud.
View all posts by Makarand Thengdi
Thanks for sharing this, probably saved me a good couple hours of headaches : )