开发者

Run a script once an element changes

开发者 https://www.devze.com 2023-04-07 14:12 出处:网络
How w开发者_如何学Pythonould I monitor an element, for example a picklist or updated form object, for any changes and then code once any change occurs?$(\'#element-id\').live(\'eventType\', function(e

How w开发者_如何学Pythonould I monitor an element, for example a picklist or updated form object, for any changes and then code once any change occurs?


$('#element-id').live('eventType', function(e) {
   //do stuff here
});

The 'eventType' will be different based on the type of object '#element-id' is.

http://api.jquery.com/live/


$("#element").change(function(){
    //do your stuff
});

will probably do it


By using jQuery's change method.

$('#element').change(function(){
    // ... 
});
0

精彩评论

暂无评论...
验证码 换一张
取 消