radio单选框

1.写

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <script language="javascript" src="jquery.min.js"></script>
</head>
<body>
<form>
    <input type="radio" name="sex" value="1">
    <input type="radio" name="sex" value="2">
    <input type="radio" name="sex" value="3">
</form>
</body>
</html>

2.获取值

<script>
    $value=$("input[name='sex']:checked").val();
</script>

3.回显

<form><input type="radio" name="sex" value="1" <{if $data.sex=1 }> checked <{/if}>><input type="radio" name="sex" value="2" <{if $data.sex=2 }> checked <{/if}>>
    不明<input type="radio" name="sex" value="3" <{if $data.sex=3 }> checked <{/if}>>
</form>
原文地址:https://www.cnblogs.com/xiaobiaomei/p/8134313.html