开发者

show() checkbox with jqueryj

If a checkbox is hidden using jquery .hide how to s开发者_开发百科how it again if we know the value in the following case

    <input type="checkbox" value="1" name="m_q"/>
    <input type="checkbox" value="2" name="m_q"/>
    <input type="checkbox" value="3" name="m_q"/>
    <input type="checkbox" value="4" name="m_q"/>

So the check box with value 1 is hidden how to use .show using jquery


$("input[value=1]").show();


I wouldn't show/hide the checkboxes the way you are doing, but of course I am just guessing as what you actually want. I would just use one checkbox and simply update the value:

<input type="checkbox" value="4" name="m_q" id="m_q" />

Now, instead of hiding 4 and showing 1 just do this:

$("#m_q").val(1);

Or if you can't add the id:

$("input[name=m_q]").val(1);

Remember, "View Source" will not reveal the value change even if it is working.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜