tags:

views:

63

answers:

3

Hi,

I m Using a calendar.js file to implement calendar in my App. Actually this calendar .js has a line which accepts the classname and Div id name of my app.

In my App i m having these lines

 <input type="text" class="calendarSelectDate" />
 <div id="calendarDiv"></div>

When i click this textbox it will generate the calendar inthe DIv tag..

..But if i created a input tag and Div tag of my own using JQuery

$(" 1").appendTo("#hold1"); $("").appendTo("#hold1"); and use the same Class, The calendar is not generated....Suggest ME

A: 

I am not familiar with the CleanCalendar, bit I've had good experience with the JQueryUI Datepicker control.

Galwegian
A: 

You should call the line that accepts the classname and div ID AFTER creating the div and input using jquery.

Probably, when u call that line, it bind the "showCalendar" event to the elements with those class/id. But since you create the div/input after creating the event (I assume), the event won't be bound to these dynamicly created elements.

Thomas Stock
<?php echo $javascript->link('calendar.js');?> <script type="text/javascript">$(document).ready(function(){$("<input id=inputdate"+dateinc+" type= 'text' class='calendarSelectDate'></input>").appendTo("#hold1");$("<div id='calendarDiv'></div>").appendTo("#hold1");});</script>This is what i have done in Jquery..These two tags are created good But if i click that textbx it didnt show me the calendar..In this Clean Calendar actually no need to call simply giving the classname and Div will show the calendar..But it doesn't works for me..Help me
Aruna
+1  A: 

The calendar.js-script is run when loaded, and hooks up the events needed to show the calendar. If you add the input and div at some later point using jQuery, the events aren't hooked up.

If you add them in your own script with jQuery, you can solve your problem simply by moving the calendar.js-script tag to after the script tag with your code in it.

If you dynamically add the elements after page load, you have to figure out the inner workings of calendar.js and call its initialization again afterwards.

Magnar
Hi, Ya i have done like popUpCal.init(); now ..Its working now..Thanks..
Aruna