I have a Rails 4 app with the following form:
<%= form_for @link, url: links_path, html: {class: "form-horizontal"} do |f| %>
<%= f.label :title, class: 'col-sm-2 control-label' %>
<%= f.text_field :title, value: @page.title, class: 'form-control' %>
<%= f.label "Choose a category", class: 'col-sm-2 control-label' %>
<%= f.label :category, "Image", class: "col-xs-2 control-label" %>
<%= f.radio_button :category, "image" %>
<%= f.label :category, "Video", class: "col-xs-2 control-label" %>
<%= f.radio_button :category, "video" %>
<%= f.button "Submit Link", class: "btn btn-default btn-block", id: "scrape-submit-button", disabled: true %>
<% end %>
I'd like the submit button to become active once any of the radio buttons are checked using jQuery, but so far I have been unable to make it work with the following code:
$(function(){
$(document).ready(function(){
$("input:radio").change(function () {$("#scrape-submit-button").prop("disabled", false);});
})
})
Any advice would be great.
Aucun commentaire:
Enregistrer un commentaire