Saturday, 15 August 2015

jquery - why display:none does not hide struts2 tag like -



jquery - why display:none does not hide struts2 tag like <s:textfield> -

i wonder why div tag not able hide struts2 tags, using div should hide on load,and onchange calling jquery toggles div tag...

<%@ taglib prefix="s" uri="/struts-tags" %> <%@ page language="java" contenttype="text/html; charset=utf-8" pageencoding="utf-8"%> <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>insert title here</title> <script type="text/javascript" src="js/jquery-1.3.2.min.js"></script> <script type="text/javascript" > $( document ).ready(function() { $("#t").click(function(){ alert("i know not working"); $('#tt').toggle(); }); }); </script> </head> <body> <s:form > <div style="display: none;" id="tt"> <s:textfield></s:textfield> </div> </s:form> <input type="button" id="t"> </body> </html>

i tested . working 100% me :)

<%@ page language="java" contenttype="text/html; charset=iso-8859-1" pageencoding="iso-8859-1"%> <%@ taglib prefix="s" uri="/struts-tags" %> <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <title>insert title here</title> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script> $(document).ready(function(){ //jquery methods go here... $("#btnhidediv").change(function(){ $("#togglediv").toggle(); }); }); </script> </head> <body> <form> <div id="togglediv" style="display: none;"> <s:textfield type="text" name="xyz" key="xyz" size="11" label="xyz"></s:textfield><br /> <p>hieeeeeeeeeee</p> </div> <input type="text" id="btnhidediv"> </form> <body> </html>

jquery html struts2

No comments:

Post a Comment