how to control radiobutton from textfield
i want after i type "0203-ED" in textfield ...two character behind that text can control the radio button.. "ED" character from that text can make one radiobutton which has value="ED" are checked...
what script that can make it work??
<script type="text/javascript">
var model=$("#tags1").val();
va开发者_高级运维r version[0,0]="JD";
var version[0,1]="87.5-107.9";
var version[1,0]="ED";
var version[1,1]="87.5-108.0";
var version[2,0]="EED";
var version[2,1]="65.0-74.0";
version for (var i = 0; i < version.length; i ++) {
if (model,lastIndexOf(version[i,0])!=-1) {
$("#value").replaceWith("<div id='value'>"+version[i,1]+"</div>");
} else { default: $("#value").replaceWith("<div id='value'></div>")
}
}
</script>
may be it needs to combine with your answer..
var buttons = [];
//store radio buttons in the array buttons
//assign onKeyUp() to `onkeyup` attribute of the text input
function onKeyUp()
{
var input = document.getElementById("txtInput_id");
var text = input.value;
if(text.length < 2)
return;
text = text.substring(text.length - 3);
for(var i = 0; i < buttons.length; i++)
{
if(buttons[i].value == text)
buttons[i].checked = true;
}
}
精彩评论