Search code examples
javascriptjquerycsslivequery

Livequery unsupported pseudo issue


I am using livequery in order to detect created elements and apply some css.

It works, but I have a problem with certain selectors.

HTML:

<p id="Test:SomeElement.Id">TEST3</p>

JS:

$("body").livequery("#Test\:SomeElement\.Id" , function() { 
$(this).css('color', 'red');
})

The example above will generate this error:

Syntax error, unrecognized expression: unsupported pseudo: SomeElement

enter image description here

Looks like its a bug in livequery since jquery won't fail with this selector.

This is the JS fiddle http://jsfiddle.net/20f05p33/1/ Please scroll the js frame to the bottom in order to skip the livequery library.


Solution

  • User \\ instead of \

    $("body").livequery("#Test\\:SomeElement\\.Id" , function() { 
      $(this).css('color', 'red');
    })
    

    Or

    $("body").livequery('p[id="Test:SomeElement.Id"]' , function() { 
          $(this).css('color', 'red');
    })