Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery trigger onChange

I have a input text field which is filled with the url of an image using a jQuery function. How do I use the "onChange" event of the input to run the jQuery function?

like image 670
user1018809 Avatar asked Feb 05 '12 16:02

user1018809


2 Answers

Try this -

$('#myId').trigger('change');

Put it in any function where you are changing the url in the textbox.

like image 70
tempid Avatar answered Sep 21 '22 19:09

tempid


If you update field by JavaScript, than after changing value just call on it change()

$('#myId').val('new_url').change();
like image 38
Slawomir Wdowka Avatar answered Sep 20 '22 19:09

Slawomir Wdowka