吴伟贤のBlog

Feed Rss

jquery input radio点击显示/隐藏

12.28.2010, js, by .

<script language="javascript" type="text/javascript">
$(document).ready(function() {
    $("#show").hide();
    $(":radio").click(function(){     
        if($(this).attr("id") == "yes" && ($(this).attr("checked") == true || $(this).attr("checked") == "checked")) {
            $("#show").show();
        }else{
            $("#show").hide();
        }
    })
});
</script>

<input type="radio" name="orderid" value="1" id="yes" >显示     

<input name="orderid" type="radio" value="0"  id="no" />隐藏

<div id=show>我出现了</>

评论已关闭。