Do not function css("display","block") in my program
Good Night; Im new in Jquery and I have
practicing all morning. At this time anyone suggested me, practice with
this program to see how hide and show parts of css or piece of text. This is the program, but I dont know what happened there because dont work fine, in other words, do not show neither hide the div id="formulariomayores". Im using Netbeans.
This is the code:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="jq/jquery-1.10.2.min.js" type="text/javascript"></script>
<script>
$(document).ready(function () {
$("#mayoria_edad").click(function (evento){
if($("#mayoria_edad").attr("checked")) {
$("#formulariomayores").css("display","block");
} else {
$("#formulariomayores").css("display","none");
}
});
});
</script>
<title>JSP Page</title>
</head>
<body>
<form>
Nombre: <input type="text" name="nombre"/>
<br/>
<input type="checkbox" name="mayor_edad" value="0" id="mayoria_edad"/> Soy mayor de Edad
<br/>
<div id="formulariomayores" style="display: none;">
Dato para Mayores de Edad <input type="text" name="mayores_edad"/>
</div>
</form>
</body>
</html>
Thanks in advance for help me.
Luis