Escape curly brackets in ID in jQuery

I have a table in SharePoint list view which ID contains curly brackets '{9C48B48F-AA4E-4B34-8CE6-37E4C0EBAD8B}-{9B1EEE61-5E3C-4CA1-96CD-DB15199EDC83}'. I tried to select the table using jQuery but on the brackets I've got a Javascript error about a sequence of characters.

As it turned out, you should escape symbols '{}'. The simplest way to call element with ID equal to '{9C48B48F-AA4E-4B34-8CE6-37E4C0EBAD8B}-{9B1EEE61-5E3C-4CA1-96CD-DB15199EDC83}' is like this:

The code below displays all the headers in SharePoint view table:

$(document).ready(function() {
    $('#\\{9C48B48F-AA4E-4B34-8CE6-37E4C0EBAD8B\\}-\\{9B1EEE61-5E3C-4CA1-96CD-DB15199EDC83\\} tbody tr th').each(function () {


No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment Notes of web-specialist
Since 2009