Bug Tracker

Opened 13 years ago

Closed 12 years ago

#6195 closed bug (worksforme)

Parent > child selector problem

Reported by: jltouchette Owned by:
Priority: low Milestone: 1.4.3
Component: selector Version: 1.4.2
Keywords: Parent Child Cc:
Blocked by: Blocking:


This doesn't work


$("#myID > div.myClass").click(function(event){



Change History (4)

comment:1 Changed 13 years ago by cowboy

What isn't it doing that you'd like it to do?

comment:2 Changed 13 years ago by ajpiano

Can you please provide more information about the "bug" that is on display here? A test case? Otherwise this ticket will be closed as invalid shortly.

comment:3 Changed 13 years ago by sakthikumar

Hi, the related scenario not working for me. Below is my sample HTML to re-produce the issue. Pls have the jquery.js files to run the script.

<html> <head>

<script src="jquery-1.2.3.min.js"></script> <!--script src="jquery-1.4.2.min.js"></script-->

<script> $(document).ready(function(){

$("#main").next(".buttons > .clickme").bind("click", function(){

alert("Works in jQuery 1.2.3");

Not working in 1.4.2


$("#main ~ .buttons > .clickme").bind("click", function(){

alert("Works in jQuery 1.4.2");


}); </script>

</head> <body>

<span id="main">

</span> <span class="buttons">

<a class="clickme">Click Me</a><br>


</body> </html>

comment:4 Changed 12 years ago by addyosmani

Priority: low
Resolution: worksforme
Status: newclosed

As the original poster hasn't supplied a valid test case, I recreated one using the information provided and updated to use spans just in case sakthikumar (see above) also wanted to see how ID -> elem.className could be used:


You can also achieve what you were trying to do using .children() as per here:


Closing. Please feel free to re-submit your ticket if the issue persists.

Note: See TracTickets for help on using tickets.