As Pierre says, html() will add full html whereas text() will turn any
tags into entities, for example:

$('div').html('<b>bold</b>'); will output <b>bold</b> into the DOM, whereas
$('div').text('<b>bold</b>'); will output &lt;b&gt;bold&lt;/b&gt; -
which is the string version of the HTML - into the DOM

Rik

2008/11/19 Pierre Bellan <[EMAIL PROTECTED]>:
> Hello,
>
> val() is for the form element ( input, select ), to get/set the value
>
> html() is what i use to add small html inside an element.
> I use the append method when the html to add is huge.
>
> i have never used the text() method. I understand that the text() method is
> like a php:strip_tags function for getting the value and php:html_entities
> for setting.
>
> Pierre
>
> Fred Allen  - "An associate producer is the only guy in Hollywood who will
> associate with a producer."
>
> 2008/11/19 ginko100 <[EMAIL PROTECTED]>
>>
>> Hello,
>>
>> what's the difference between:
>> html();
>> val();
>> text();
>>
>> what's the best way to add html to a div??
>>
>> thanks.
>
>



-- 
Rik Lomas
http://rikrikrik.com

Reply via email to