jquery - Chain .on() with .not() to remove unneeded elements from the object -


I have a web form, that I do not need to include these inputs. So for example, an input which I do not need to force the event that happens first. It should only be bound to those inputs that affect the reducing effect while navigating away from the window.

This is the current binding to me:

  formChanged = false; $ ('Change.form_change', 'input: not (.leave-change-allowed), textarea: no (. Leave-change-allowed), select: not (.leave) - change ()), work () {if formchanged} {formChanged = true; $ (window) .bind ('beforeunload', function) (if (formChanged) {return 'are you sure you navigate From this window, you will lose the unsaved changes. ';}});} And {$ (this). Unbund (' change.form_change ');}});   

As you can see I have included the elements of the selector as : not (.leave-change-allowed) , to select form elements Separated by commas for However, I do not want to add the selector to no () , because there can be some selectors, I want to add to no () , but I want to input every form input Need to apply to input , textarea and select . Please keep in mind these elements are dynamic, so I .on () instead of .change () .

How can I chain the dynamic elements with .not () function? So I retain the selector and pass all the unnecessary elements into the .not () function

Check the target for the square within the function:

  formChanged = false; $ ('Change.form_change', 'input, textarea, select', function (e) {if (! (Formchanged || $ (e.target) .is ('. Leave (change)')) {formChanged = true ; $ (Window) .on ('beforeunload', function () {if (formchanged) {return 'Are you sure you want to navigate away from this window, you will lose unsaved changes'.}}} );} And {$ (this) .off ('change.form_change');}});    

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -