js特殊字符轉義

 html標籤id屬性中包含「 [ 」 、「 ] 」等特殊字符,Jquery選擇器沒法獲取到指定對象,須要對特殊字符進行轉義。     //轉義字符 function changeString(selectid) { selectid = selectid.replace(/\[/g, "\\["); selectid = selectid.replace(/\]/g, "\\]"); retur
相關文章
相關標籤/搜索