Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>use the double backslashes:</p> <pre><code> jQuery("#someform\\:somepanel\\:somebutton") </code></pre> <p>Related:</p> <ul> <li><a href="https://stackoverflow.com/questions/739695/jquery-selector-value-escaping">jQuery selector value escaping</a></li> <li><a href="https://stackoverflow.com/questions/3332122/when-do-i-need-to-escape-metacharectars-jquery-selectors">When do I need to escape metacharectars? (jQuery Selectors)</a></li> <li><p><a href="http://api.jquery.com/category/selectors/" rel="nofollow noreferrer">http://api.jquery.com/category/selectors/</a></p> <ul> <li>If you wish to use any of the meta-characters ( such as <code>!"#$%&amp;'()*+,./:;?@[\]^{|}~</code> ) as a literal part of a name, you must escape the character with <strong>two</strong> backslashes: <code>\\.</code> For example, if you have an an element with <code>id="foo.bar"</code>, you can use the selector <code>$("#foo\\.bar")</code>. The W3C CSS specification contains the <a href="http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier" rel="nofollow noreferrer">complete set of rules regarding valid CSS selectors.</a></li> </ul></li> </ul> <hr> <p>Update #1</p> <p>After your comment in regards to <em>auto</em> escaping the best method I see is to create a function within the string object like so</p> <pre><code>String.prototype.escape = function() { return this.replace(/([ #;&amp;,.+*~\':"!^$[\]()=&gt;|\/])/g,'\\$1') } </code></pre> <p>you can also specifically define a function for the colons like so:</p> <pre><code>String.prototype.escape_colon = function() { return this.replace(/:/,'\\$1') } </code></pre> <p>and use like so:</p> <pre><code>jQuery("someform:somepanel:somebutton".escape()) </code></pre> <p>but this will cause issues on pseudo selectors such as:</p> <pre><code>jQuery("someform:somepanel:somebutton:first".escape()) </code></pre> <p>the <code>:first</code> selector will be escaped and therefore you will not find your element.</p> <p>but y our best bet will be to build a string parser within the prototype to replace where it finds a specific set of chars such as:</p> <pre><code>jQuery("someform(_e(:))somepanel(_e(:))somebutton:first".escape()) </code></pre> <p>this way you can define what you want to escape, but if that was the case you may as well escape them yourself.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload