Monday, 28 March 2016

Why jQuery is not working properly with Struts2 application ?


Problem: jQuery is not working properly with Struts2 application.

Solution: Remember following 2 points :
1. Use s:head with theme="ajax" tag inside HTML head tag.
<head>
  <s:head theme="ajax" debug="true" />
</head>

2. Use scripts for jQuery inside body
<body>
  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
  </script>
  <script>
  $(document).ready(function(){
    $("#flip").click(function(){
      $("#panel").slideToggle("slow");
    });
  });
  </script>
  ....
  ....
</body>

No comments:

Post a Comment

Note: only a member of this blog may post a comment.