Question

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?

Was it helpful?

Solution

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      
    }
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top