I have (over 10) inputs in my HTML form. In the initial state, all of these inputs are disabled by default. There is also a select element that changes the property of disabled exact inputs when selecting based on the selected value. In other words, the select element contains parameters that indicate which input to include. Now I want to enable accurate input based on the selected option. How can I do that?
Add a class to the "exclusive", for example. special :
special
<input ... class='special' />
Then enable everything except this with:
$('input').not('.special').removeAttr('disabled');
$('select').change(function() { if ($(this).val() === 'whatever') { $(':input:not(.whatever)').removeAttr('disabled'); } });
Source: https://habr.com/ru/post/1332187/More articles:What "& 0xFFFFFFFF" does in this HIDWORD macro - c ++how to read an image from a specific url in android - androidAre there any Delphi components for writing Facebook applications? - facebookPHP: any function that returns the first / last N elements of an array - arraysChanging a PHP Array Key - arraysHow would I scale a two-dimensional array in python? - pythonSwitching panels and transferring data to Swing - javaCreating a BlackBerry SQLite Database: βFile System Not Readyβ - blackberryGet HTML table data - htmlInterview. Find similar items from two linked lists and return the result as a linked list. - javaAll Articles