jQuery in Action, 2nd edition*
The moose likes HTML, CSS and JavaScript and the fly likes How to display the popup on the button click using Jquery Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How to display the popup on the button click using Jquery" Watch "How to display the popup on the button click using Jquery" New topic
Author

How to display the popup on the button click using Jquery

umesh annegirikar
Greenhorn

Joined: May 09, 2011
Posts: 28
hello friends
I am working on JSP currently i am facing the following problem
In my page there is button Add on that button i want to open JQuery popup but doing all that efforts i am not able to display the popup.
Following is my code.

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="java.util.ArrayList"%>
<%@page import="com.udhc.model.City"%>
<%@page import="com.udhc.model.Country"%>
<%@page import="com.udhc.model.State"%>

<%@page import="com.udhc.config.ApplicationConstant"%>
<%@page import="com.udhc.model.User"%>
<%@page import="com.udhc.model.Professional"%>
<%@page import="org.apache.struts.Globals"%>


<jsp:include page="Header.jsp"></jsp:include>

<script type="text/javascript" language="javascript" src="js/jquery-1.4.3.min.js"></script>
<link type="text/css" href="css/stylesheet.css" rel="stylesheet"></link>
<script type="text/javascript">
$(document).ready(function ()
{
$("#btnShowSimple").click(function (e)
{
ShowDialog(false);
e.preventDefault();
});

$("#btnShowModal").click(function (e)
{
ShowDialog(true);
e.preventDefault();
});

$("#btnClose").click(function (e)
{
HideDialog();
e.preventDefault();
});

$("#btnSubmit").click(function (e)
{
var brand = $("#brands input:radio:checked").val();
$("#output").html("<b>Your favorite mobile brand: </b>" + brand);
HideDialog();
e.preventDefault();
});

});

function ShowDialog(modal)
{
$("#overlay").show();
$("#dialog").fadeIn(300);

if (modal)
{
$("#overlay").unbind("click");
}
else
{
$("#overlay").click(function (e)
{
HideDialog();
});
}
}

function HideDialog()
{
$("#overlay").hide();
$("#dialog").fadeOut(300);
}
</script>

<%@taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>


Also please guide me about how to use the jquery in jsp application.Some speciman code samples are appreciable
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to display the popup on the button click using Jquery
 
Similar Threads
How to call jquery method in Struts.
calling the struts action on jquery button click
how do i use checkbox as an active/inactive button for a form?
object required js error
/struts-tags not found exception in struts2