Problem with HTML inside Javascript

Posted by Vafello on Stack Overflow See other posts from Stack Overflow or by Vafello
Published on 2010-03-18T18:43:02Z Indexed on 2010/03/18 18:51 UTC
Read the original article Hit count: 253

Filed under:
|
|
|

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?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery