Difference between html() method and text() method

Difference between html() method and text() method is so simple. Actually the difference is in their name.

Difference:

you can write some html code within html() method … however you can not write html code in text() method as parameter. My mistake you can write some html code in text() method but during the compilation the compiler will take it as a plain text. That is if you write something like this ..

.text(‘<b> hello world </b>’);

output: <b> hello world </b>’

and if you write the same code in html() method the output will be

hello world

now use those two method according to your need .. 🙂

Advertisements
By kfelahi Posted in JQuery

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s