jQuery add Share Icon script

Posted by Eddie Parker on Stack Overflow See other posts from Stack Overflow or by Eddie Parker
Published on 2010-04-13T06:16:44Z Indexed on 2010/04/13 6:23 UTC
Read the original article Hit count: 638

Filed under:
|
|

Hello:

I'm trying to add via jQuery the share icon [1]. Unfortunately I can't seem to do this as jQuery appears to escape the script code and I can't seem to get it to work with .text() or .html().

Has anyone gotten this, or something similar, working?

The code I'm trying is:

var enc = $('<div/>')
            .text('<script type="text/javascript" src="http://w.sharethis.com/button/sharethis.js#publisher=faa9f152-cae0-4ff3-bab7-32ae934bc698&amp;type=website&amp;style=ro
            ;

$('<div/>')
    .appendTo(nav)
    .addClass('navItem')
    .append(eval(enc))
    ;

[1] http://sharethis.com/

© Stack Overflow or respective owner

Related posts about sharethis

Related posts about JavaScript