Featured Post

Jquery .html()

.html()
.html()
Get the HTML contents of the first element in the set of matched elements.
.html(htmlString)
Set the HTML contents of each element in the set of matched elements.
Returns: String
.html()
Get the HTML contents of the first element in the set of matched elements.
This method is not available on XML documents.

In an HTML document, .html() can be used to get the contents of any element. If the selector expression matches more than one element, only the first match will have its HTML content returned. Consider this code:

$('div.demo-container').html();
In order for the following
's content to be retrieved, it would have to be the first one with class="demo-container" in the document:


Demonstration Box


The result would look like this:

Demonstration Box

This method uses the browser's innerHTML property. Some browsers may not return HTML that exactly replicates the HTML source in an original document. For example, Internet Explorer sometimes leaves off the quotes around attribute values if they contain only alphanumeric characters.

Example Demo
Click a paragraph to convert it from html to text.









Click to change the html




to a text node.



This does nothing.




Comments

salam kenal bos. lagi jalan jalan pagi nih