jquery - 将 jquery 链接添加到返回的文本

标签 jquery css ajax plugins

我正在尝试将两个 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/

相关文章:

javascript - 使用 AJAX 调用 Mailchimp API

ajax - 如何通过单击 MVC 中的 html 操作链接打开一个新的弹出窗口?

javascript - jQuery slider 未正确突出显示

javascript - 浏览器如何在大声朗读时突出显示单词/句子?

html - 选定行,更改第一个和最后一个单元格边框

javascript - 打开键盘android,隐藏内容phonegap

javascript - 替换没有完整类名的类名

jquery - 如何根据角色隐藏 Web 应用程序用户的选项卡

jQuery - 当元素可见时删除背景颜色

javascript - 带有文件上传的 AngularJs Ajax POST 表单