Curtis Crewe
Curtis Crewe

Reputation: 4336

Append HTML Code from Javascript

How can i change this function which is currently appending a CSS class to a div on HTML

if (!this.sortDisabled) {
        var $th = $(this).addClass(table.config.cssHeader);
        if (table.config.onRenderHeader) table.config.onRenderHeader.apply($th);
}

to make to append this instead of adding class "table.config.cssHeader"

'&nbsp<font face="webdings">6</font>'

So my question explained is how can i get this

if (!this.sortDisabled) {
    var $th = $(this).addHTMLCODE(&nbsp<font face="webdings">6</font>);
    if (table.config.onRenderHeader) table.config.onRenderHeader.apply($th);
}

Upvotes: 0

Views: 118

Answers (1)

icktoofay
icktoofay

Reputation: 129011

It looks like you're using jQuery. You're pretty close; instead of addHTMLCODE, you need append, and you also need to quote the HTML:

var $th = $(this).append('&nbsp<font face="webdings">6</font>');

Upvotes: 1

Related Questions