0

I have a function that is currently triggered by a focusout of an input element via

$('#wrapper').on('focusout','input[name=state]',function(){ 
    /* execute function */
});

The problem I am having is if someone decides to just skip that element with say a mouse click (as this input element is auto filled using the ziptastic plugin) then the function will not trigger. I tried .on('change') but that did not seem to work.

What would be the best way to trigger this function once input[name=state] has been filled out.

2 Answers 2

1

Add a change event handler too:

$('#wrapper').on('focusout change','input[name=state]',function(){

And then also trigger the change event ($('#wrapper input[name=state]').change()) after the ziptastic plugin has been run. The change event won't fire if the value is set by .val("something").

Sign up to request clarification or add additional context in comments.

Comments

0

You can use onchange, it occurs either before or after the onblur.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.