jQuery / Javascript - 如何在更改按鈕值時觸發事件?

[英]jQuery/Javascript - How to fire an event when a button's value is changed?

I am working on a plugin for jQuery that will essentially style certain elements. Like jqTransform I could just replace the element but I chose to position the real element off screen and make a new element thats styled. This allows triggering the actual events of the real element. Also, if an onclick handler or onchange handler for a textbox is there, jqTransform will not include that whereas this way, it will include it.


Here is my problem. Say a user has a button. Later on in the app the user decides to change the value of the button. It will change the original button's value but not the styled button. Is there any way I can connect the elements so that if the original button's value is changed the styled button's value is changed as well?


1 个解决方案


you can catch any property change on object using onpropertychanged event.


$("#buttonid").bind('propertychange', function(e) {
    if (e.originalEvent.propertyName == "value") {
       // value is changed, handle it here      



  © 2014-2022 ITdaan.com 联系我们: