jquery - Chain .on() with .not() to remove unneeded elements from the object -
I have a web form, that I do not need to include This is the current binding to me: As you can see I have included the elements of the selector as How can I chain the dynamic elements with Check the target for the square within the function:
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 ');}});
: 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 () .
.not () function? So I retain the selector and pass all the unnecessary elements into the
.not () 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
Post a Comment