This question already has an answer here: 这个问题在这里已有答案: jquery
I have some input text fields in my page and am displaying their values using JavaScript. 个人页面中有一些输入文本字段,并使用JavaScript显示其值。 ide
I am using .set("value","")
function to edit the value, add an extra checkbox field, and to pass a value. 我使用.set("value","")
函数来编辑值,添加一个额外的复选框字段,并传递一个值。 函数
Here I want to check that if value == 1
, then this checkbox should be checked. 在这里,我想检查若是value == 1
,则应选中此复选框。 Otherwise, it should remain unchecked. 不然,它应该保持未选中状态。 this
I did this by using two divs, but I am not feeling comfortable with that, is there any other solution? 我经过使用两个div来作到这一点,但我对此感到不舒服,还有其余解决方案吗? spa
if(value == 1) { $('#uncheck').hide(); $('#check').show(); } else{ $('#uncheck').show(); $('#check').hide(); }