How do I get jQuery to select elements with a . (period) in their ID?

后端 未结 8 1280
南笙
南笙 2020-11-22 13:16

Given the following classes and controller action method:

public School
{
  public Int32 ID { get; set; }
  publig String Name { get; set; }
  public Address         


        
8条回答
  •  佛祖请我去吃肉
    2020-11-22 13:54

    Using two Backslashes it´s ok, it´s work. But if you are using a dynamic name, I mean, a variable name, you will need to replace characters.

    If you don´t wan´t to change your variables names you can do this:

    var variable="namewith.andother";    
    var jqueryObj = $(document.getElementById(variable));
    

    and than you have your jquery object.

提交回复
热议问题