jQuery Syntax error, unrecognized expression

This question already has an answer here:

  • What are valid values for the id attribute in HTML? 21 answers

  • As per docs

    To use any of the meta-characters ( such as !"#$%&'()*+,./:;<=>?@[]^`{|}~ ) as a literal part of a name, it must be escaped with with two backslashes: . For example, an element with id="foo.bar", can use the selector $("#foo.bar")

    You need to escape special character in selector or use name value attribute instead:

     jQuery("[id='{44C80A95-F3E4-40DA-9A97-50CADFFFED61}-{DD02CEA7-CC2B-4E4A-A725-86E82C6D11FC}']").attr("width","100%");
    

    By escaping the brackets ?

    jQuery("#{44C80A95-F3E4-40DA-9A97-50CADFFFED61}-{DD02CEA7-CC2B-4E4A-A725-86E82C6D11FC}").attr("width","100%");
    

    Source of inspiration: jquery escape square brackets to select element

    or better, see Milind Anantwar answer use $("[id='anything here']")

    链接地址: http://www.djcxy.com/p/15446.html

    上一篇: html id / class第一个符号数字,是否有效?

    下一篇: jQuery语法错误,无法识别的表达式