jquery - True-False condition inline on HTML element (checkbox) -
i have code:
<input type='checkbox'>
i want make conditional using jquery, example, if data[1].condition
true
, set checked, if not not.
may like:
<input type='checkbox' + if data[1].condition false, unchecked + "'> <input type='checkbox' + if data[1].condition true, checked + "'>
is there way set inline? like:
<input type='checkbox' + data[1].condition | checked + "'>
there's not way inline.
using jquery...
if(data[1].condition === false){ $('input').removeattr('checked'); } else { $('input').prop('checked', true); }
Comments
Post a Comment