我正在尝试将两个 jquery 插件文件添加到我的应用程序中。当用户触发我的 ajax 事件时,服务器将返回带有表单按钮的文本。当用户单击返回文本内的表单按钮时,插件(jquery 日历)将起作用。我相信我必须在返回文本而不是主页中添加链接才能让代码正常工作,但不确定如何执行此操作。我正在给出我的代码,需要各位专家的意见。谢谢。
我的主页 html
//required jquery plugins ...didn't work if I add them in the main application.
<script type="text/javascript" src="JS/date.js"></script>
<script type="text/javascript" src="JS/datePicker.js"></script>
<script type="text/javascript" src="JS/selectWeek.js"></script>
<div id="gameInfo">
//return text will be displayed here.
</div>
我返回的文本...其中一部分...
<form>
<div id=returnDiv>
// the form input will be added here when a user clicks #addMatch button...
</div>
<tr>
<td><input type="button" id="addMatch" name="addMatch" value="Add Match"/> </td>
</tr>
</form>
我的jquery
$("#addMatch").live('click', function(){
//the code below will create a calendar when a user click the link...I am not sure //where I should add my two jquery plugins link...
$("#returnDiv").html("<td><input type='text' size='6' class='date-pick dp-applied'"+ "name='date'><a style='color:white;' class='dp-choose-date' title='Choose Date'"+ "href='#'>Date</a></td>";
return false;
});
我希望我能很好地解释我的问题。对任何回复+1...:D
最佳答案
杰瑞使用 Jquery UI datepicker 。它有很好的文档记录并且易于使用。
关于jquery - 将 jquery 链接添加到返回的文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2909582/