0

I have asp.net generated html code. I want execute jQuery click function when user click on <a class="ctl00_Menu1_1 ctl00_Menu1_6" href="..">Download</a></td> hyper link.I have div id ctl00_Menu1n2Items for recognize the and .

How to generate event for 2nd hyper link?

<div id="ctl00_Menu1n2Items" class="ctl00_Menu1_0 adjustedZIndex ctl00_Menu1_8">
<table border="0" cellpadding="0" cellspacing="0">
    <tr id="ctl00_Menu1n13">
        <td>
        <table class="ctl00_Menu1_7" >
            <tr>
                <td><a class="ctl00_Menu1_1 ctl00_Menu1_6" href="..">TAR Report</a></td>
            </tr>
        </table>
        </td>
    </tr>       
    <tr id="ctl00_Menu1n16">
        <td>
        <table class="ctl00_Menu1_7" >
            <tr>
                <td ><a class="ctl00_Menu1_1 ctl00_Menu1_6" href="..">Download</a></td>
            </tr>
        </table>
        </td>
    </tr>       

1
  • @DG3 I am trying to execute JQuery function when user clicks on <a class="ctl00_Menu1_1 ctl00_Menu1_6" href="..">Download</a> Commented Mar 29, 2012 at 19:38

3 Answers 3

1
$("#ctl00_Menu1n16 a").click(function(){alert("Clicked me");})
Sign up to request clarification or add additional context in comments.

Comments

1

try this:

$("a", "#ctl00_Menu1n2Items")[1].click(function(e){})

Comments

-1

The TR for each menu item has a unique ID. You can leverage that ID.

$("#ctl00_Menu1n16 a.ctl00_Menu1_1").click(...);

2 Comments

It doesn't work for me. <script language="javascript" type="text/javascript"> $(document).ready(function() { $("#ctl00_Menu1n16 a.ctl00_Menu1_1 ctl00_Menu1_6").click(function() { alert("Hi");
Woops, copy/pasted too many CSS classes. I've updated the example.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.