Create calendardateselect from javascript

Posted by 99miles on Stack Overflow See other posts from Stack Overflow or by 99miles
Published on 2010-03-18T16:16:04Z Indexed on 2010/03/19 4:41 UTC
Read the original article Hit count: 239

Filed under:
|
|

Not sure why I can't figure this out. When a user makes a selection, a javascript method is called, at which point I want to add a calendardateselect to an existing div tag from the javascript.

According to the docs, it seems like this should work:

var a = new CalendarDateSelect( document.getElementById("date_area"), {embedded:true, year_range:10} );
$('date_area').insert(a);

... or maybe this....

var newScript   = document.createElement('script');
newScript.type  = 'text/javascript';
var tn      = document.createTextNode("new CalendarDateSelect( $(this).previous() )");
newScript.appendChild(tn);
$('date_area').insert(newScript);

http://code.google.com/p/calendardateselect/wiki/JavascriptDocumentation

But neither of them are working. I feel like I've tried everything. Ideas?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about ruby-on-rails