I\'ve got an issue with jquery where I set the html of a div using the html method, but it does not set it correctly.
Here\'s the stripped down code I\'m using:
As Aito says, you need double quotes:
$('#results').html("<div class='tweet'><a href=\"javascript:sendDirectMessage('1711838', 'abc')\">DM</a><hr/></div>");
Perhaps you should enclose with double quotes:
<a href=\"javascript:sendDirectMessage('1711838', 'abc')\">
You forgot to quote your href
attribute.
Therefore, it stopped parsing the href
's value after the first space.
You need to write the following:
$('#results').html(
"<div class='tweet'><a href=\"javascript:sendDirectMessage('1711838', 'abc')\">DM</a><hr/></div>"
);
The \"
creates a "
inside a double-quoted string.
Try this:
$('#results').html('<div class="tweet"><a href="javascript:sendDirectMessage(\'1711838\', \'abc\')">DM</a><hr/></div>');