This time I will share jQuery Plugin and tutorial about Watch For CSS/Attribute/Property/Input/Select Changes – jQuery selectWatch, hope it will help you in programming stack.
selectWatch is a jQuery plugin for developers that watches for CSS styles, attributes, properties, and input/select values of a DOM element.
Also provides a callback function which can be used to output the old/new values when triggered.
How to use it:
1. Load the minified version of the jQuery selectWatch plugin after loading jQuery JavaScript library.
1 |
< script src = "/path/to/jquery.slim.min.js" ></ script > |
2 |
< script src = "/path/to/selectWatch.min.js" ></ script > |
2. Select the type you want to watch for. Available types:
- element
- attr
- prop
- input
- select
3. Define the callback function.
1 |
function callBack(oldValue, newValue) { |
2 |
alert("Old: " + oldValue + " New: " + newValue); |
4. Attach the function to the desired element and done.
1 |
$( "#myElement" ).selectWatch(callBack, settings); |
Changelog:
2021-03-29