KaranGupta
asked on
Issue in code
Hi
What is the issue in the code.
When I click on the link message box is not coming.
Regards
Karan Gupta
What is the issue in the code.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Write_Output_Write.aspx.cs"
Inherits="Write_Output_Write" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<%--<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />--%>
<title></title>
<script src="http://code.jquery.com/jquery-latest.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
$(document).ready(
function() {
$("ul#websiteList li a").click(
function($e) {
alert("Hello");
}
);
}
);
</script>
</head>
<body>
<form id="form1" runat="server">
<ul id="websiteList">
<li><a href="http://www.google.com">google</a></li>
</ul>
<ul>
<li><a href="http://www.rediff.com">Rediff</a></li>
</ul>
</form>
</body>
</html>
When I click on the link message box is not coming.
Regards
Karan Gupta
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
HI sonawanekiran
I don't see any difference in the code. What is the difference in the code? I have executed both the codes and is not working.
Regards
Karan Gupta
I don't see any difference in the code. What is the difference in the code? I have executed both the codes and is not working.
Regards
Karan Gupta
Yes. Both of our code is correct. Sorry I haven't checked your code. Do you want to show the alert when you click on Rediff also?
Below link is domo for your script
http://jsfiddle.net/TpSZG/ 2/
When you click on google it shows the alert "Hello"
http://jsfiddle.net/TpSZG/
When you click on google it shows the alert "Hello"
Try either of the below
<body>
<ul id="websiteList">
<li><a href="http://www.google.com">google</a></li>
<li><a href="http://www.rediff.com">Rediff</a></li>
</ul>
</body>
or
<body>
<ul id="websiteList">
<li><a href="http://www.google.com">google</a></li>
</ul>
<ul id="websiteList">
<li><a href="http://www.rediff.com">Rediff</a></li>
</ul>
</body>
<body>
<ul id="websiteList">
<li><a href="http://www.google.com">google</a></li>
<li><a href="http://www.rediff.com">Rediff</a></li>
</ul>
</body>
or
<body>
<ul id="websiteList">
<li><a href="http://www.google.com">google</a></li>
</ul>
<ul id="websiteList">
<li><a href="http://www.rediff.com">Rediff</a></li>
</ul>
</body>
Open in new window