I have a div
<div id="dialog-confirm-error-validating-choices" title="Pop up">
<p><span class="floatLeft"></span>
<p id="error-message"></p></p>
</div>
that I select with jQuery and I put it into a variable
var messageDialog = $('#dialog-confirm-error-validating-choices');
I want to set the inner html of an element within this variable
messageDialog.filter('#error - message').innerhtml("Hello");
Is this how it is done? Can it be done?
Try this:
Note that
innerHtmlis the method to change the HTML of a plain javascript element, whereas for a jQuery object you need to use thehtml()method. Also, the convention is to prefix variables which contain jQuery objects with a$.