2

I'm a beginner and I'm wondering if there is a way to remove multiple attributes once without coding for each one.

For an example, please look at my code sample below.

$(".select-us").attr("disabled",true);
$(".select-as").attr("disabled",true);
$(".select-eu").attr("disabled",true);
$(".select-oc").attr("disabled",true);

I just want to know if there is any simpler way to do this. Thanks for your time.

0

3 Answers 3

2
$(".select-us, .select-as, .select-eu, .select-oc").attr("disabled", true);
Sign up to request clarification or add additional context in comments.

Comments

1

Please wrap your multiple form elements in fieldset and disable/ enable this only

<fieldset id='fset' disabled={true}>
...

can disable and enable with jquery like this

$("#fset").attr('disabled', true)

Comments

1

Add a new class to every element like "select-all" and do:

       $(".select-all").attr("disabled",true);

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.