4

i can add checked property using following code

$('#specificCheckBox').prop('checked', true);

but how can remove this property using jquery or Javascript.

1

3 Answers 3

6

Don't remove it, but set it to false:

$('#specificCheckBox').prop('checked', false);
Sign up to request clarification or add additional context in comments.

4 Comments

on input element there no true or false only checked property is enough, that is confusion for me.
@SwapL Here you want to set the property, not the attribute but ya it's quite confusing, see e.g: stackoverflow.com/questions/5874652/prop-vs-attr You could still set the attribute instead but using prop for this kind of 'property' is the preferred method
@SomnathKharat that's true! But OP was asking to remove it which IMHO is quite different than usual similar questions and still doesn't explain why you have posted an answer too ;)
issue is not for posting ans its for upvote and the qus is not for u.its for those who upvoted
1

IN javascript:

document.getElementById("specificCheckBox").checked = false;

In Jquery:

$('#specificCheckBox').prop('checked', false);//version 1.6+

Comments

0

here is the fiddle

$('#btnCheck').click(function(){
    $('#check').attr('checked', true);
});

$('#btnUncheck').click(function(){
    $('#check').attr('checked', false);
});

Comments

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.