2
我有这样的代码:真假条件直列
<input type='checkbox'>
我要让有条件使用jQuery,例如,如果data[1].condition
是true
,然后将其选中,如果没有的话不。
可能是这样的:
<input type='checkbox' + if data[1].condition is false, unchecked + "'>
<input type='checkbox' + if data[1].condition is true, checked + "'>
有没有一种方法来设置它内联?例如:
<input type='checkbox' + data[1].condition | checked + "'>
你是否使用任何JS库或JS? – user1027620
你使用了什么样的模板语言?你不能只用HTML来做到这一点。 – Steve
我很困惑...你想避免JS或jQuery? –