I know this is a recurring question, but I can't get it to work. I tried all the solutions I found here in SO and googling ...
I have this button form on my page. I want that when the user selects the "only one participant" option, ONLY a text field appears for this parameter. If the user selects another, he disappears.

As soon as the user selects only one parameter, a text box appears.

I tried to do with javascript. I use this piece of code
<script>
$(document).ready(function()
$("#send_to_one").hide();
$("input:radio[name="people"]").change(function(){
if(this.checked){
if(this.value =='one'){
$("#send_to_one").show()
}else{
$("#send_to_one").hide();
}
}
}
});
</script>
Form code
<div id="send_to">
<input type="radio" id="send_poll" name="people" value="all" checked="checked">all the attendees</br>
<input type="radio" id="send_poll" name="people" value="one" >only one attendee<br/>
<div id="send_to_one">
<label>Write the attendee name: </label><input type="text" id="attendeename"><br/><br/>
</div>
<input type="radio" id="send_poll" name="people" value="group">a group of attendees</br>
</div>
, javascript. javascript- html.erb, , .js application.htm.erb <head></head>, . , ?
Rails 3.0.4, Ruby 1.8.9. JQuery