0

Given this checkbox:

<input data-index="7" data-name="Sector-108" type="checkbox">

how do I uncheck this checkbox based on the data-name attribute selector?

3 Answers 3

1

You can use attribute selector

$('[data-name=Sector-108]').prop('checked',true);

You can use attribute selector starts with wild card to get all the elements having name like Sector-

$('[data-name^=Sector-]').prop('checked',false);
Sign up to request clarification or add additional context in comments.

Comments

0
$('input[data-name=Sector-108]).removeProp('checked');

Comments

0

You can use it as below.

$('input').hasAttr('data-name').attr('checked','checked');

1 Comment

i want to select based on data-name attr value.Lets I have Sector-108 then how can i find the checkbox and dessable it?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.