Ich habe eine foreach, die 3 Radiobuttons enthalten, wie aktiviere ich eine bestimmte Taste, wenn der Radiobutton aktiviert ist? Ich habe dies:Wie aktivieren Knopf auf dem Radiobutton
// Starts by disabling all the buttons
$('.btn-portabilizar').attr('disabled', true);
// If it is checked, enable the a specific button
$('input[name="autorizacao"]:checked').click(function(){
$('.btn-portabilizar').removeAttr('disabled');
});
Und meiner Meinung nach ist dies:
<% @autorizacoes.each do |autorizacao| %>
<tr>
<td><%= radio_button_tag 'autorizacao', autorizacao.numero_contrato %></td>
<td><%= autorizacao.numero_contrato %></td>
<input class="string required" type="text" name="portabilidade_nova_parcela" id="portabilidade_nova_parcela">
</td>
<td>
<%= link_to "Portabilizar", "#", :class => 'btn btn-primary btn-portabilizar' %>
</td>
</tr>
<% end %>
Sorry für Code in portugiesisch ...
UPDATE ============ ===========================
Wenn aktiviert, aktivieren Sie die Schaltfläche, wenn deaktiviert deaktivieren, mache ich es, aber nicht funktionieren:
$('input[name="autorizacao"]').click(function(){
if (this.checked) {
$(this).closest('tr').find('.btn-portabilizar').prop('disabled', false);
}
else
$(this).closest('tr').find('.btn-portabilizar').prop('disabled', true);
});
Was ist falsch?
nur deaktiviert auf false gesetzt – thatOneGuy
Mann nicht funktionieren ... –