Thursday, 15 January 2015

javascript - Disabling all input elements except some in a form using jQuery -


I am trying to disable almost all input elements in the form using jquery, but to enable me Some input elements are required. For example:

  $ (document) .ready (function () {$ ("# document: input [name! = 'TloEnable']). Attr (" disabled ", true) ;});  

This works very well on elements similar to 'tloEnable' elements. However, there are some other elements that have different name attributes (file names, notifications, notifications) How can I include them while disabling the remaining input elements?

  $ (document) .ready (function () {$ ("# document: input [name! = 'TloEnable ], [Name! = 'Filename'], [name! = 'Notify '], [Name! =' Notification ']). Et ("disabled", true);});  

Use a selector and pass it; Matched elements will be excluded:

  $ (document) .ready (function () {$ (": input") No. ("[name = tloEnable], [name = Filename], [name = notifyUsers] ") .Press (" disabled ", true);});  

works the same way:

  $ (document) .ready (function () {$ (": input: not ([name = tloEnable ], [Name = filename], [name = notifier]) ".prop (" disable ", true);});  

No comments:

Post a Comment