Hola, estoy intentando mostrar un campo del formulario u otro segun el radio button que chequee.
¿Cómo puedo hacerlo?
He probado asi, pero nada:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
$('input[name=DNI]').click(function () {
if ($('input[name=DNI]:checked').val() == "checked") {
$('#tab1').show();
} else {
$('#tab1').hide();
}
});
});
</script>
DNI: @Html.RadioButtonFor(model => model.Documento, "Yes", new {id="DNI", name = "DNI", Checked = "checked" })
NIE: @Html.RadioButtonFor(model => model.Documento, "NIE")
<div id="tab1">
@Html.EditorFor(model => model.DNI)
@Html.ValidationMessageFor(model => model.DNI)
</div>
¿Qué hago mal?
Gracias
Jose