jQuery contains() with a variable syntax

后端 未结 3 853
面向向阳花
面向向阳花 2020-12-03 13:50

I have an \"uncaught exception: Syntax error, unrecognized expression: )\" in a jQuery application.

The code is:



        
3条回答
  •  离开以前
    2020-12-03 13:56

    I have used this answer in order to solve a similar problem.
    I want to prevent the use of " and '

    When using $("p:contains('" + valor + "')").addClass("on");, it works.

    But when using $('p:contains('" + valor + "')**'**).addClass("on"), it does not!

提交回复
热议问题