Problem with HTML inside Javascript
- by Vafello
I am trying to implement 'time-ago' feature in my website using a JQuery timeago plugin. Unfortunately I have encountered some problems.
<script type="text/javascript" charset="utf-8">
jQuery("abbr.timeago").timeago();
</script>
var content = document.getElementById('div');
var html = "<abbr class=timeago title=2008-07-17T09:24:17Z></abbr>" + '<br><br>';
content.innerHTML += html
<div id='div'></div
This jquery plugin basically convert timestamp from the title and print it in a nice format for every abbr class=timeago. The problem is that the code above doesn't work, but if I put it within this div it works fine. I think it is maybe because this jquery plugin is applied before generating html by javascript, but I am not sure. Any ideas?