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

后端 未结 8 1220
南笙
南笙 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:46

    I solved the issue with the solution given by jquery docs

    My function:

    //funcion to replace special chars in ID of  HTML tag
    
    function jq(myid){
    
    
    //return "#" + myid.replace( /(:|\.|\[|\]|,)/g, "\\$1" );
    return myid.replace( /(:|\.|\[|\]|,)/g, "\\$1" );
    
    
    }
    

    Note: i remove the "#" because in my code i concat the ID with another text

    Font: Jquery Docs select element with especial chars

提交回复
热议问题