Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I enable all inputs when a certain select option is chosen?

Tags:

jquery

I have some(more than 10) inputs in my HTML form. On initial state all this inputs are disabled by default. There is also select element which changes exact inputs disabled property while selection made on it based on its selected value. In other words select element contains options which indicates which input need to be enabled. Now I want to enable exact input based on selected option. How it can be done?

like image 531
AEMLoviji Avatar asked Feb 25 '23 14:02

AEMLoviji


1 Answers

Add a class to the 'exceptional' one, e.g. special:

<input ... class='special' />

Then enable all but this with:

$('input').not('.special').removeAttr('disabled');
like image 104
sje397 Avatar answered Feb 28 '23 02:02

sje397