Skip to main content

Bug Tracker

Side navigation

#12715 closed bug (notabug)

Opened October 12, 2012 10:27AM UTC

Closed October 12, 2012 01:07PM UTC

Function .closest() adds string 'closest(selector)' to variable this.selector

Reported by: andrew_lz@poczta.fm Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.8.2
Keywords: Cc:
Blocked by: Blocking:
Description

Is it correct behavior that function closest add string 'closest(selector)' to field this.selector?

Code:

		var form = $('form[name=xxx]').closest('form');
		var x = form.find('[name=users_activity]');
		$(x).live('change', function(){
			alert('OK!');
		});

If I try change value in select list ([name=users_activity]) firebug shows this error:

Error: Syntax error, unrecognized expression: form[name=xxx].closest(form) [name=users_activity]
throw new Error( "Syntax error, unrecognized expression: " + msg );

In jQuery 1.3.2 this example code works good.

Attachments (0)
Change History (1)

Changed October 12, 2012 01:07PM UTC by dmethvin comment:1

resolution: → notabug
status: newclosed
$(x).live('change', function(){ ...

The only support would be if x is a string, and in this example it is a jQuery object. See the documentation for .live(), which btw is deprecated. http://api.jquery.com/live/