Trying to get the value=\"\" of to change upon selection of a radio button. So if the user
Really Simple fiddle.
Using code:
$(document).ready(function(){
$("input[type=radio]").click(function(){
$("#it").val(this.value);
});
});
And HTML:
<input type="text" id="it" value="">
<input type="radio" name="hey" value="one">
<input type="radio" name="hey" value="two">
<input type="radio" name="hey" value="three">
This demonstrates the concept of how to do it.
it will bind an event handler change of all inputs inside the form searchSelect, with name option1 and of type radio.
$(function() {
$('#searchSelect input[name="option1"]:radio').change(function() {
$('.box').val('Enter a ' + this.value);
});
});
to learn more about the change event check out the jQuery documentation.
$(document).ready(function() {
$("input[name=option1]:radio").click(function(eventObj) {
$("input[name=searchQuery]").val("Enter a " + $(eventObj.target).val());
});
});
Give the radio input a class of "option" or call it what ever
<input type='radio' class='option' name='option' value='First Name'>
Then the jquery:
$('.option').click(function(){
var thisRadio = $(this).val();
$('.box').val(thisRadio);
});
<script type="text/javascript">
$(document).ready(function(){
$('#searchSelect input[type=radio]').change(function(){
$('input.box').val('Enter ' + $(this).val());
});
});
</script>