How to make radio button selected using span values?
am having a coding like this, i want to make the radio button get selected
when user enters the character count match in span value, i don't have any
id for span, and radio button. am having only class name and it listed the
ul. I want to do this by jquery.
Enter your name: <input type="text">
<div class="attribute_list">
<ul>
<li><input type="radio" value="22" name="group_5"
class="attribute_radio"><span>10</span> </li>
</ul>
<ul>
<li><input type="radio" value="23" name="group_5"
class="attribute_radio"><span>14</span> </li>
</ul>
</div>
my jquery is like this,
<script>
$(document).ready(function(){
$("input").keyup(function(){
var y=$("input").val();
var x=$(".attribute_list span").html();
if(x==y)
{
alert(x);
}
});
});
instead of alert, i need to make that radio button get selected. any help
please..
No comments:
Post a Comment