Okay, so I still am having issues trying to include JS inside my BBCode Extensions..
Here is another issue I need help on. If anyone is familiar with JS I could use help with it.
Here is my Fiddle:
http://jsfiddle.net/GG9Sa/4266/
Here is the code I need help with:
<script>
for( var _i = 1; _i <= 31; _i += 1 ){
var _addClass = '';
if( _i === 5 ){ _addClass = ' class="selected"'; }
document.write( '<li><a href="#" title="'+_i+'" data-value="'+_i+'"'+_addClass+'>'+_i+'</a></li>' );
}
</script>
This part of the code is what is used to highlight the day of the month. What I want it to do is automatically highlight the day of the month - using JS.
Currently I need to change the "5" in if( _i === 5)
Im trying to make it so it uses d.getDate();
to automatically replace the 5 with whatever number the day of the month is.
Any help would be greatly appreciated. As you can see, I am working on a Calendar Extension.
Thanks.
Update: here is the fix for my problem.
<script>
var date = new Date().getDate();
for( var _i = 1; _i <= 31; _i += 1 ){
var _addClass = '';
if( _i === date ){ _addClass = ' class="selected"'; }
document.write( '<li><a href="#" title="'+_i+'" data-value="'+_i+'"'+_addClass+'>'+_i+'</a></li>' );
}
</script>
http://jsfiddle.net/ht0dc2nz/3/