1
I have a form with 3 options, 3 radio.
If option 1 is checked, Form1 appears and so on.
Each radio is inside a div, that is, if I click on the div, it checks the radio.
My problem is, if I click on the radio... the matching form appears, but if I click on the div, it checks the radio but does not appear the form.
My html and js are like this, below:
HTML
<form id=form>
<div id=conteiner>
<input type=radio name=opcao value="A" id=form1>
</div>
<div id=conteiner>
<input type=radio name=opcao value="B" id=form2>
</div>
<div id=conteiner>
<input type=radio name=opcao value="C" id=form3>
</div>
</form>
<form action="form1.php" method=post id=A style="display:none;">
<input type=text>teste1
</form>
<form action="form2.php" method=post id=B style="display:none;">
<input type=text>teste2
</form>
<form action="form3.php" method=post id=C style="display:none;">
<input type=text>teste3
</form>
JS
$(document).ready(function(){
$('#form-planos').change(function() {
if ($('#form1').prop('checked')) {
$('#A').show();
$('#B').hide();
$('#C').hide();
} else {
if ($('#form2').prop('checked')) {
$('#B').show();
$('#A').hide();
$('#C').hide();
} else {
$('#A').hide();
$('#B').hide();
$('#C').show();
}
}
});
});
$("#conteiner").live("click",function(event) {
var target = $(event.target);
if (target.is('input:radio')) return;
var checkbox = $(this).find("input[type='radio']");
if( checkbox.attr("checked") == "" ){
checkbox.attr("checked","true");
} else {
checkbox.attr("checked","");
}
$("div.assinatura").click(function () {
$('input:radio').attr('checked',false);
});
});
$(function(){
$('table').on('click', 'td', function(){
$(this).parent().children().removeClass('active');
$(this).addClass('active');
});
});
It worked brother.. thank you very much. I think the cat jump was the label :) vlw same
– Eduardo Cruz
Eduardo, see this link http://meta.pt.stackoverflow.com/a/1079/23400 how to accept the answer, thus marking the question as resolved.
– gustavox