I want to run a script on page load first time (for default value of select element), and then on each change of select element. Is it possible to do it in one line, or do I need to duplicate function for this events?
I know that I can use next structure:
$('#element').on('keyup keypress blur change', function() {
...
});
But it doesn't seem to support load event.
Any ideas?
for change element use your :
and to use same function on load first time use structure like:
to call the same function
If i understand what you mean, just trigger any one of these events:
Instead of using anonymous functions (defining them right where they will be used) you could just create a regular function and tell jQuery to call it when those events happen.