I have a type select
dropdown, after the selection, Redirects. I want them to be warned that they try to navigate away without saving using this select
dropdown.
While selecting this specific type
as one of the input types
while defining an input type has changed. This is my script, but it does not do the desired work (where .seend1
select the actual type
context):
$ (Document) .on ('change', '.seend1', function () {if ($ (": input") No. ('Send1')) {$ (": input"). Function () {Unsaved = true;});}});
If unsaved
== is correct, users have a warning that there are unsaved changes.
.not ()
method returns a jQuery object, and any object Is considered a true value in javascript, you should use the length
property to check the length of the collection. But here it is not the main problem, the whole argument seems not promising. If you want to exclude an element from the selection, you can use : no
in your selector:
var unsaved = false; $ (Document) .on ('change', '.seend1: not ("select.specific")', function () {unsaved = true;}); $ ('Select.specific'). ('Change', function () {if (unsaved) {// show a model / alert something ...} other {// redirect}});
Comments
Post a Comment