|
.html( [ HTML_String ] )
Gets the innerHTML of an element. Sets the innerHTML of an element if HTML_String is provided and returns the new innerHTML.
Parameters
Returns
Example 1
Gets innerHTML of #cont div.
JS
HTML
$.domLoaded(function() {
$.get("#get").on("click", function() {
// get the innerHTML of #cont
var co = $.get("#cont").html();
alert(co);
});
});
Result
Example 2
Sets innerHTML of #cont div.
JS
HTML
$.domLoaded(function() {
$.get("#get").on("click", function() {
// set innerHTML of #cont
$.get("#cont").html("<a href='http://www.nediljs.com' target='_blank'>Nedil JS</a>");
});
});
Result
| |||||||||||||||
