我已经更新了jQuery JS,将我的1.8.2替换为最新的1.10.2,这就是 - 我的选项卡和手风琴不再工作了。我之前在选项卡中的手风琴运行良好,当然必须更改一些内容才能将其恢复,但以我对JS的有限了解,我相信除了回滚到1.8.2之外没有简单的方法,坦率地说我不想这样做。所以我的问题是 - 如何在现有 html 结构中正确更新 JS 以保留功能。有什么建议,至少在哪里看?谢谢。
以下是我拥有的选项卡中手风琴的结构:
<div id="Chapters"> <!--Begin Tabs-->
<ol type="1">
<li><a href="#Ch1">Chapter 1</a></li>
<li><a href="#Ch2">Chapter 2</a></li>
<li><a href="#Ch3">Chapter 3</a></li>
</ol>
<div id="Ch4" title="Chapter 4">
<h2 class="Chapter">Chapter 4</h2>
<div class="SubChapter" id="SubCh1" title="Title chapter 4">
<h3>Title chapter 4</h3>
<div><p>content</p></div>
<div class="questions"> <!--Begin Accordion -->
<div id="QBlock">
<table id="QTable">
<tr><td><div id="QNumber">4.1</div></td>
<td><div id="QText">text of question</div></td> <!-- Accordion panel header -->
</tr></table></div>
<div>
<table id="RTable"> <!--Accordion panel content -->
<tr><td><div id="Guidance"><p>Content</p></div></td>
<td><div id="Response" class="Response">
<label><input type="radio" name="Radio401" value="Y" id="Radio_401Y" onchange='radioChange(this, "401")'>Yes</label>
<label><input type="radio" name="Radio401" value="N" id="Radio_401N" onChange='radioChange(this, "401")'>No</label>
<label><input type="radio" name="Radio401" value="NS" id="Radio_401NS" onChange='radioChange(this, "401")'>Not Seen</label>
<label><input type="radio" name="Radio401" value="NA" id="Radio_401NA" onChange='radioChange(this, "401")'>Not Applicable</label>
</div>
<span id="responseDetails">
<div id="Observation">
<label for="observation">Observation:</label>
<textarea name="observation" id="Obs401"></textarea></div>
<div id="DueDate">
<label for="DueDate">Due date:<br></label>
<input name="DueDate" type="date" id="DueDate401"/>
</div>
<div id="actions">
<label for="actions">Actions required to correct and/or prevent this observation:</label>
<textarea name="actions" id="pa401"></textarea>
</div>
</span>
</td>
</tr>
</table>
</div>
将新的 jQuery JS 代码粘贴到现有文件(不是外部 js)中时,请确保避免覆盖这段代码:
<script>
$(function () {
$(".questions").accordion();
$("#Chapters").tabs();
// Hover states on the static widgets
$("#dialog-link, #icons li").hover(
function () {
$(this).addClass("ui-state-hover");
},
function () {
$(this).removeClass("ui-state-hover");
}
);
});
</script>