There is a block with id "/text/text" on the page "/text/text" need to access it using jquery. I try this way - $("#/text/text") , but I get an error associated with the wrong expression. It is the first "/" that interferes, since everything is fine without it.

    2 answers 2

    $(document.getElementById('/test/test'))

      Escape character / double backslash:

       function func() { $('#\\/text\\/text').text('test'); } 
       <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div id="/text/text"><div> <button onclick="func()">Проверить</button> 

      Read more in the documentation .