set check working for two time only.
->once it checked
-> then unchecked
but i want this something like toggle. please fix this code.
$('#a').click(function() {
if ($("#radioinstant").is(':checked')) {
$("#radioinstant").removeAttr('checked', 'checked'); //This line
}else{
$("#radioinstant").attr('checked', 'unchecked');
}
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<div>
With JQuery Function: <input type="checkbox" id="radioinstant"/>
<a id="a" href="#">set check</a>
</div>
thanks in advance