I have a QUnit test suite and am calling
$('#idForElement').html();
inside a QUnit test (which is registered on $(document).ready(), and then run), but this function returns null in Chrome, Firefox and IE.
However, in the script tab of Firebug in Firefox, I am able to get the expected string by adding the code as a watch expression and can see a HTML element displayed on the page and in the HTML tab of Firebug.
I've read http://api.jquery.com/html/, I have assigned this into new var, an initalised string, put the result of $('#idForElement'); into a variable and called .html() on that, tried alerts in those browsers.
What's the next step to get this working?
var foo = $("#idForElement");was indeed pulling the DOM node you were looking for? Keep in mind that.html()pulls in the innerHtml of an element, so if the node contains nothing, you'll get nothing..appending tofoosuccessfully.