innerHTML (attribute or function)

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

innerHTML (attribute or function)

Heiko Bauer
hi there,

i don't know if i'm wrong, but innerHTML isn't an Attribute but rather
a funktion?!

So the function $().html() should look like that:

html: function(h) {
    return h === null && this.size() ?
    this.get(0).innerHTML : this.get(0).innerHTML = h;
},

instead of:

html: function(h) {
    return h === null && this.size() ?
    this.get(0).innerHTML : this.set( "innerHTML", h );
},



_______________________________________________
jQuery mailing list
[hidden email]
http://jquery.com/discuss/
Reply | Threaded
Open this post in threaded view
|

Re: innerHTML (attribute or function)

Matt Stith
Actually I'm pretty sure it's an attribute... Have you tried using it as a
function without jquery yet? Something like
document.getElementById("somediv).innerHTML('blah');
?

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On
Behalf Of Heiko Bauer
Sent: Friday, May 26, 2006 9:09 AM
To: [hidden email]
Subject: [jQuery] innerHTML (attribute or function)

hi there,

i don't know if i'm wrong, but innerHTML isn't an Attribute but rather a
funktion?!

So the function $().html() should look like that:

html: function(h) {
    return h === null && this.size() ?
    this.get(0).innerHTML : this.get(0).innerHTML = h; },

instead of:

html: function(h) {
    return h === null && this.size() ?
    this.get(0).innerHTML : this.set( "innerHTML", h ); },



_______________________________________________
jQuery mailing list
[hidden email]
http://jquery.com/discuss/


_______________________________________________
jQuery mailing list
[hidden email]
http://jquery.com/discuss/
Reply | Threaded
Open this post in threaded view
|

Re: innerHTML (attribute or function) == property

Christian Bach
I did some testing and changing the function for setting the innerHTML
property as Heiko Bauer proposed, removes the element attribute
innerhtml="" in mozilla firefox.

Is this a known bug, John?

Reading:
http://developer.mozilla.org/en/docs/DOM:element.innerHTML
http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/innerhtml.asp

/christian

Matt Stith wrote:

> Actually I'm pretty sure it's an attribute... Have you tried using it as a
> function without jquery yet? Something like
> document.getElementById("somediv).innerHTML('blah');
> ?
>
> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] On
> Behalf Of Heiko Bauer
> Sent: Friday, May 26, 2006 9:09 AM
> To: [hidden email]
> Subject: [jQuery] innerHTML (attribute or function)
>
> hi there,
>
> i don't know if i'm wrong, but innerHTML isn't an Attribute but rather a
> funktion?!
>
> So the function $().html() should look like that:
>
> html: function(h) {
>     return h === null && this.size() ?
>     this.get(0).innerHTML : this.get(0).innerHTML = h; },
>
> instead of:
>
> html: function(h) {
>     return h === null && this.size() ?
>     this.get(0).innerHTML : this.set( "innerHTML", h ); },
>
>
>
> _______________________________________________
> jQuery mailing list
> [hidden email]
> http://jquery.com/discuss/
>
>
> _______________________________________________
> jQuery mailing list
> [hidden email]
> http://jquery.com/discuss/
>
>  

_______________________________________________
jQuery mailing list
[hidden email]
http://jquery.com/discuss/

christian.bach.vcf (280 bytes) Download Attachment