Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%= radio_button_tag "content[id]", content.id%><%= content.title %>
- <%= f.text_field :title %>
- $(document).ready(function(){
- $(".radioClassName").click(function(){
- $(".TextBoxClassName").val($(".radioLabelClassName").text());
- });
- });
- <input type=radio class="radioClassName"><label class="radioLabelClassName">my text"</label>
- <input type="text" class="TextBoxClassName">
- <form>
- <input type="radio" id="sex" name="sex" value="male" /> Male<br />
- <input type="radio" id="sex" name="sex" value="female" /> Female
- <input type="text" name="des" id="des" />
- </form>
- $("#des").val($("#sex").val());
- $("#sex").change(function(){
- alert($("#sex").val());
- $("#des").val($("#sex").val());
- });
- Demo
- <%= radio_button_tag "content[id]", content.id, {}, {:title => content.title} %><%= content.title %>
- <input id="content_id_<content.id>" type="radio" value="<content.id>" title="<content.title>" name="content[id]" />
- jQuery(function(){
- // For each radio button whose name is 'content[id]':
- jQuery("input[type='radio'][name='content[id]']").each(function(index, button){
- // Give the button a certain click behaviour:
- jQuery(button).click(function(){
- // Set the value of 'title' textfield to the radio's title
- jQuery("#title").val(this.title);
- });
- });
- });
Add Comment
Please, Sign In to add comment