开发者

JS Show field when checked

How do i show an input field if #tryout checkbox is chec开发者_运维技巧ked.

I already have this which hides 2 fields, now i want to show 3 new fields..:

$('#tryout').click(function () {
    $('#title').toggle(!$(this).attr('checked'));
    $('.navn').toggle(!$(this).attr('checked'));
});


Chain your selectors in this case:

$('#tryout').click(function () {
    $('#title, .navn').toggle(!$(this).attr('checked'));
    $('#newfield1, #nf2, #nf3').toggle($(this).attr('checked'));
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜