在jquery中,有人在“”双引号中提到类名和id,有人用单引号''表示... 这两件事有什么不同。
答案 0 :(得分:2)
在JavaScript中,双引号和单引号之间绝对没有区别。只是一个偏好问题。
答案 1 :(得分:1)
'提及班级名称和身份'是什么意思?
顺便说一句,一般来说单身和双重看看这里:答案 2 :(得分:1)
在某些情况下,当您还想在字符串中使用双引号时,可能需要使用单引号,例如:
<script>
// Finds all inputs with a name attribute that contains the word 'man' and sets the value with some text.
$('input[name~="man"]').val('mr. man is in it!');
</script>
除此之外,它们之间没有区别。只是一个偏好问题。
答案 3 :(得分:0)
在jquery中有人使用类名,id就像这个$('。someclass')$('#someclass')或$(“。someclass”)$(“#someclass”)。 那么这两件事之间的主要区别是什么