[jQuery] Re: How to add html do a div properly? (html(), val(), or text() ?)

2008-11-21 Thread ginko100

ok guys.
thank you both.


[jQuery] Re: How to add html do a div properly? (html(), val(), or text() ?)

2008-11-19 Thread Rik Lomas

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

$('div').html('bold'); will output bold into the DOM, whereas
$('div').text('bold'); will output bold -
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


[jQuery] Re: How to add html do a div properly? (html(), val(), or text() ?)

2008-11-19 Thread Pierre Bellan
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.
>