Add jquery link to returned text...
Posted
by Jerry
on Stack Overflow
See other posts from Stack Overflow
or by Jerry
Published on 2010-05-26T01:08:39Z
Indexed on
2010/05/26
1:31 UTC
Read the original article
Hit count: 252
Hi all I am trying to add two jquery plugins files to my application. When a user triggers my ajax event, the server will return text with a form button. The plugins (a jquery calendar) will work when the user clicks the form button inside the returned text . I believe I have to add the link inside the return text instead of the main page to let the code work, but not sure how to do this. I am giving out my code and need you experts opinions. Thanks.
My main page 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>
My returned text ...part of it....
<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>
My jquery
$("#addMatch").live('click', function(){
//the code below will create a calender 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;
});
I hope I explain my question well. +1 to any reply...:D
© Stack Overflow or respective owner