Why doesn't this jquery selector with a period work

后端 未结 9 2020
长发绾君心
长发绾君心 2020-12-06 04:56

I have a div with an ID

this jquery selector works

$(\"[id^=\'updates-pane         


        
9条回答
  •  醉酒成梦
    2020-12-06 05:22

    For sure period creating problem for JQuery to recognise the pattern.

    jQuery has three type of selectors:

    1. "." selector means to select an element by class name.
    2. "#" selector means to select an element by ID.
    3. And Element selector that selects elements by their name(div, input etc.)

    And you have confused jQuery engine with your naming convention of ID.

    Its assuming that there is a div with id="updates-pane-user" and a applied class="followed_on". In such cases jQuery suggest to escape sequence using //. Below should be your syntex to select the element.

    $("#updates-pane-user\\.followed_on");
    

    Check it out this wrong fiddle and try to correct using // : http://jsfiddle.net/ukJ8Z/

    Cheers!!

提交回复
热议问题