大家好,当一个选项按钮选择另一个选项按钮出现时,我正在尝试做。It works but when the other option button is selected I wanna display text but it does not work here is my code:
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.4.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$(".select-box").change(function() {
if ($(".select-box option[value='3']").attr('selected')) {
document.getElementById("demo").innerHTML="<select class='select-box'><option value='4'>a</option><option value='5'>b</option></select>";
if ($(".select-box option[value='5']").attr('selected')) {
document.write("Hello")
}
}
});
});
</script>
</head>
<body>
<select class="select-box">
<option>Select an option</option>
<option value="1">no alert</option>
<option value="2">no alert too</option>
<option value="3">alert</option>
</select>
<p></br>
<div id="demo"></div>
</body>
</html>