Bug Tracker

Opened 7 years ago

Closed 7 years ago

#12715 closed bug (notabug)

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

Reported by: andrew_lz@… 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.

Change History (1)

comment:1 Changed 7 years ago by dmethvin

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/

Note: See TracTickets for help on using tickets.