Javascript JQuery行正在破坏我的页面
因此,我正在为我正在开发的一个站点开发一点jQuery,出于某种原因,当我在双引号Firefox中添加单引号时,在它的永恒荣耀中,将它们更改为双引号,从而破坏了我的代码 我甚至试着把它放在一个外部javascript文件中,尽管我现在只是在做原型。无益。不会加载文件Javascript JQuery行正在破坏我的页面,javascript,jquery,debugging,firefox,Javascript,Jquery,Debugging,Firefox,因此,我正在为我正在开发的一个站点开发一点jQuery,出于某种原因,当我在双引号Firefox中添加单引号时,在它的永恒荣耀中,将它们更改为双引号,从而破坏了我的代码 我甚至试着把它放在一个外部javascript文件中,尽管我现在只是在做原型。无益。不会加载文件 $("#clips").after("<ul id='slideshow-nav'><li><a id='gallery-next' href='#' title='View the next piec
$("#clips").after("<ul id='slideshow-nav'><li><a id='gallery-next' href='#' title='View the next piece'>Next</a></li><li><a id='gallery-prev' href='#' title='View the previous piece'>Prev</a></li></ul>");
$(“#clips”)。在(
我做错什么了吗?你试过切换单引号和双引号吗
$("#clips").after('<ul id="slideshow-nav"><li><a id="gallery-next" href="#" title="View the next piece">Next</a></li><li><a id="gallery-prev" href="#" title="View the previous piece">Prev</a></li></ul>');
$(“#剪辑”)。在('ul id=“slideshow nav”>'之后);
您是否尝试过切换单引号和双引号
$("#clips").after('<ul id="slideshow-nav"><li><a id="gallery-next" href="#" title="View the next piece">Next</a></li><li><a id="gallery-prev" href="#" title="View the previous piece">Prev</a></li></ul>');
$(“#剪辑”)。在('ul id=“slideshow nav”>'之后);
您是否考虑过:-
$("#clips").after('<ul id="slideshow-nav"><li><a id="gallery-next" href="#" title="View the next piece">Next</a></li><li><a id="gallery-prev" href="#" title="View the previous piece">Prev</a></li></ul>')
$(“#剪辑”)。之后(“- /ul>”)
?
虽然在Javascript中使用“可交换的用法”和“可交换的用法”在HTML/XML中定义属性值是很正常的,但很少使用“的用法”来分隔属性值。您是否考虑过:-
$("#clips").after('<ul id="slideshow-nav"><li><a id="gallery-next" href="#" title="View the next piece">Next</a></li><li><a id="gallery-prev" href="#" title="View the previous piece">Prev</a></li></ul>')
$(“#剪辑”)。之后(“- /ul>”)
?
虽然在Javascript中使用“和”可交换的用法在HTML/XML中使用“来限定属性值是很正常的,但在FF3.5中我无法重现这个错误
<div id="clips">test</div>
<script type="text/javascript">
$("#clips").after("<ul id='slideshow-nav'><li><a id='gallery-next' href='#' title='View the next piece'>Next</a></li><li><a id='gallery-prev' href='#' title='View the previous piece'>Prev</a></li></ul>");
</script>
测试
$(“#剪辑”)。在(
给我:
<div id="clips">test</div>
<ul id="slideshow-nav">
<li><a title="View the next piece" href="#" id="gallery-next">Next</a></li>
<li><a title="View the previous piece" href="#" id="gallery-prev">Prev</a></li>
</ul>
测试
我无法重现FF3.5中的错误
<div id="clips">test</div>
<script type="text/javascript">
$("#clips").after("<ul id='slideshow-nav'><li><a id='gallery-next' href='#' title='View the next piece'>Next</a></li><li><a id='gallery-prev' href='#' title='View the previous piece'>Prev</a></li></ul>");
</script>
测试
$(“#剪辑”)。在(
给我:
<div id="clips">test</div>
<ul id="slideshow-nav">
<li><a title="View the next piece" href="#" id="gallery-next">Next</a></li>
<li><a title="View the previous piece" href="#" id="gallery-prev">Prev</a></li>
</ul>
测试
在FF 3.5.2中对我来说很好。是否将其包装为$(函数(){});要确保加载DOM
<html>
<head>
<title>tt</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js"></script>
<script type="text/javascript">
$(function() {
$("#clips").after("<ul id='slideshow-nav'><li><a id='gallery-next' href='#' title='View the next piece'>Next</a></li><li><a id='gallery-prev' href='#' title='View the previous piece'>Prev</a></li></ul>");
});
</script>
</head>
<body>
<div id='clips'></div>
</body>
</html>
tt
$(函数(){
$(“#剪辑”)。在(
在FF 3.5.2中对我来说很好。是否将其包装为$(函数(){});要确保加载DOM
<html>
<head>
<title>tt</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js"></script>
<script type="text/javascript">
$(function() {
$("#clips").after("<ul id='slideshow-nav'><li><a id='gallery-next' href='#' title='View the next piece'>Next</a></li><li><a id='gallery-prev' href='#' title='View the previous piece'>Prev</a></li></ul>");
});
</script>
</head>
<body>
<div id='clips'></div>
</body>
</html>
tt
$(函数(){
$(“#剪辑”)。在(
看起来不错。有几件事可以尝试:
为可读性而重新构造(是相同的代码,使用末尾带有.join(“”)的数组):
$(“剪辑”)
.在([
“
”
].加入(“”)
);
重命名ID只是为了确保页面上没有冲突(通常有奇怪的错误):
$(“剪辑”)
.在([
“
”
].加入(“”)
);
使用带转义字符的所有双引号:
$("#clips")
.after( [
"<ul id=\"slideshow-nav2\">",
"<li><a id=\"gallery-next2\" href=\"#\" title=\"Next piece\">Next</a></li>",
"<li><a id=\"gallery-prev2\" href=\"#\" title=\"Previous piece\">Prev</a></li>",
"</ul>"
].join('')
);
$(“剪辑”)
.在([
“
”
].加入(“”)
);
看起来不错。有几件事可以尝试:
为可读性而重新构造(是相同的代码,使用末尾带有.join(“”)的数组):
$(“剪辑”)
.在([
“
”
].加入(“”)
);
重命名ID只是为了确保页面上没有冲突(通常有奇怪的错误):
$(“剪辑”)
.在([
“
”
].加入(“”)
);
使用带转义字符的所有双引号:
$("#clips")
.after( [
"<ul id=\"slideshow-nav2\">",
"<li><a id=\"gallery-next2\" href=\"#\" title=\"Next piece\">Next</a></li>",
"<li><a id=\"gallery-prev2\" href=\"#\" title=\"Previous piece\">Prev</a></li>",
"</ul>"
].join('')
);
$(“剪辑”)
.在([
“
”
].加入(“”)
);
嗯,这对我有用吗
嗯,这对我有用吗
单引号和双引号在JavaScript和HTML中均有效: HTML: “” JavaScript: “”
单引号和双引号在JavaScript和HTML中均有效: HTML: “” JavaScript: “”