我正在尝试将可排序的 Jquery UI 合并到下面的无序列表中。当我单击下面表单中的按钮时,它会将文本插入#companyassessment_set1,然后提交表单。
当我尝试为可排序部分包含 javascript 时,没有任何效果(现有的 jquery 代码 + 可排序功能)。代码在这里:
$(document).ready(function(){
$('#menu-pages').sortable();
});
其余代码:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.3/jquery-ui.min.js"></script>
<script src="http://twitter.github.io/bootstrap/assets/js/jquery.js"></script>
<script src="http://twitter.github.io/bootstrap/assets/js/bootstrap-tab.js"></script>
<script>
jQuery(function () {
$('#test').click(function (e) {
e.preventDefault();
alert('test');
data = 'Benefits,Predictable hours,Up or out,Job for life,Great corporate strategic vision,Strong profitability,Performance-based,Strong alumni network,Effective managers,Fast growth,Salary and bonus,Little ranking between employees,No working on the weekends,Competitive environment,Great brand for the resume,International opportunities,Brand recognition,Smart people,Stock growth,Perks,No layoffs,Type-A employees,Fast advancement,Reasonable hours'
$("#companyassessment_set1").val(data);
$("form#new_companyassessment").submit();
});
});
</script>
<p>
<label for="companyassessment_Company Name">Company name</label><br />
<div class="field_with_errors"><input id="companyassessment_name" name="companyassessment[name]" size="30" type="text" value="" /></div>
</p>
<ul class="menu" id="menu-pages">
<li id="page_1">Home</li>
<li id="page_2">Blog</li>
<li id="page_3">About</li>
</ul>
<input id="companyassessment_set1" name="companyassessment[set1]" type="hidden" />
<input id="test" type="button" value="Set Value" />
关于如何合并 Jquery UI 代码的任何建议?