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

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -