Skip to main content

Bug Tracker

Side navigation

#9831 closed bug (invalid)

Opened July 15, 2011 09:58AM UTC

Closed July 15, 2011 01:13PM UTC

children() bug

Reported by: anonymous Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.6.2
Keywords: Cc:
Blocked by: Blocking:

to reproduce

run the following code

<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8" />
<style type="text/css">
		width: 140px;

<script src=""></script>

	$.fn.multiSelect = function(){
		var $this = $(this);
		var selects = $this.children();'click change',function(){

	$.fn.multiSelect2 = function(){
		var $this = $(this);
		var selects = $this.find('select');'click change',function(){



<form id="catform" class="c">
	<select size="10" class="cat1" name="cat1">
		<option value="property" >bất động sản</option>
		<option value="service" >dịch vụ</option>
	<select size="10" class="cat2" name="cat2" style="margin:0 15px">
		<option value="job-21" >an ninh - bảo vệ</option>
		<option value="pet-4" >khác</option>
	<select size="10" class="cat3" name="cat3">
		<option value="clothing-1-11" >ví</option>
		<option value="computer-11-3" >webcam</option>


Then try to run multiSelect2 on $('.catform'). you will see, the code is basically the same, but multiSelect 2 will work, multiSelect() will not

Attachments (0)
Change History (1)

Changed July 15, 2011 01:13PM UTC by ajpiano comment:1

resolution: → invalid
status: newclosed

Thank you for your time and interest in helping the jQuery project, but I am reasonably confident that this is not a bug. As it is stated on the docs for .live,

DOM traversal methods are not supported for finding elements to send to .live(). Rather, the .live() method should always be called directly after a selector

.children() is a traversal method - as is find - so to be honest, I'm surprised it's working in either case, but the former *certainly* is not supported. This seems like an ideal use case for .delegate over .live