Home > Web Front-end > JS Tutorial > body text

Implementation of jQuery special symbol escaping

高洛峰
Release: 2016-12-03 14:30:57
Original
1362 people have browsed it

我们在使用jquery选择器的时候 对一些ID属性中有特殊符号的地方需要进行转义。

列举部分如下:

<input id="entity.username" type="text" value="hello" />
alert($("#entity\\.username").val());
 
<input id="entity:username" type="text" value="hello" />
alert($("#entity\\:username").val());
 
//中间是空格
<input id="entity username" type="text" value="hello" />
alert($("#entity\\ username").val());
 
<input id="entity[username]" type="text" value="hello" />
alert($("#entity\\[username\\]").val());
Copy after login

   

以上这篇jQuery特殊符号转义的实现就是小编分享给大家的全部内容了


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template