Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uncaught Error: Syntax error, unrecognized expression: #<div/>

Tags:

jquery

After updating from jquery 1.5 to 1.8 I get the following error:

Uncaught Error: Syntax error, unrecognized expression: #<div/> 

Updating to 1.7 gives:

Uncaught Error: Syntax error, unrecognized expression: > 

Updating to 1.6 no error.

  • How do I resolve this?
  • Where do I start searching?
  • Will I have to search in the code for: "<div/>"?

EDIT: This is what Chrome tells me:

Uncaught Error: Syntax error, unrecognized expression: #<div/> base.js:4512
Sizzle.error             base.js:4512
tokenize                  base.js:4785
Sizzle.compile        base.js:4883
select     base.js:4973
select     base.js:5083
Sizzle       base.js:3912
jQuery.fn.extend.find      base.js:5171
jQuery.fn.jQuery.init       base.js:163
jQuery       base.js:44
SysElement.SysElement.Init        SysControls.js:1143
SysElement          SysControls.js:1179
SysListView.SysListView._ConstructTable       WebResource.axd:442
SysListView.SysListView._Init      WebResource.axd:661
SysListView     WebResource.axd:680
(anonymous function)       CRMAccounts.aspx:122
Sys$UI$DomEvent$addHandler.browserHandler
like image 203
Bertjuhh Avatar asked Apr 14 '26 03:04

Bertjuhh


1 Answers

The error seems to be coming from Sizzle, which is used by jquery to handle element selectors such as $('#mydiv'). It looks like you are using an invalid selector like $('#<div/>') somewhere. Perhaps you are trying to select a div using its id? - if that is the case then replace <div/> with the id of the div element. eg

<div id="mydiv">blah</div>

$('#mydiv').html('content');
like image 134
codebox Avatar answered Apr 15 '26 15:04

codebox