calling a click event inside nested divs won't fire

Posted on 2008-11-20
Last Modified: 2012-06-21
Hi There,

I'm having some issues trying to fire click event using jquery. The event works fine if I move the image outside the nested divs but as soon as I put the image back the function just wont work.

Can someone help me out with the syntax please and help me get the id value from the object so I can send it with the ajax call.

Thanks in advance.

$(document).ready(function() {

  // Add the page method call as an onclick handler for the div.

  $("#slideShowHeader.numbdots.offer-buttons" ).click(function() {


      type: "POST",

      url: "mypage.aspx",

      data: "{}",

      contentType: "application/json; charset=utf-8",

      dataType: "json",

      success: function(msg) {

        // Replace the div's content with the page method's return.









<div id="slideShowHeader">


 <div id="numbdots">

     <img src="../images/4_Button.gif" id="one" alt="" class="offer-buttons"/>





Open in new window

Question by:MrAgile
    LVL 19

    Accepted Solution

    Your getting an element with className numbdots and it should be the id in your jquery selector.

    Use $("#slideShowHeader #numbdots .offer-buttons")
    PS Mind the space in between.
    LVL 8

    Author Comment

    Hi There,

    Thanks for that!


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API ( has made its way into the popular lexicon of the English language.  A few years ago, …
    Requirements JQuery 1.6+ HTML CSS Introduction This article was inspired by an EE question ( on how to make a page show some balloons animate up a page…
    The viewer will learn how to dynamically set the form action using jQuery.
    The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now