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

后端 未结 8 1227
南笙
南笙 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条回答
  •  -上瘾入骨i
    2020-11-22 13:36

    You can't use a jQuery id selector if the id contains spaces. Use an attribute selector:

    $('[id=foo bar]').show();
    

    If possible, specify element type as well:

    $('div[id=foo bar]').show();
    

提交回复
热议问题