Link to home
Start Free TrialLog in
Avatar of MrAgile
MrAgileFlag for Australia

asked on

calling a click event inside nested divs won't fire

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.

Sean
$(document).ready(function() {
  // Add the page method call as an onclick handler for the div.
  $("#slideShowHeader.numbdots.offer-buttons" ).click(function() {
    $.ajax({
      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.
        $("#Result").text(msg.d);
      }
    });
  });
});
 
 
 
<div id="slideShowHeader">
   
 <div id="numbdots">
     <img src="../images/4_Button.gif" id="one" alt="" class="offer-buttons"/>
 
  </div>
     
</div>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Albert Van Halen
Albert Van Halen
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of MrAgile

ASKER

Hi There,

Thanks for that!

Sean