Harry B. Harry B. - 1 year ago 67
HTML Question

.append() element with more than one class

I can't find any info on whether or not it's possible to use .append() to append an element to html and give that element more than one class

$( ".nav" ).append("<li class=tab><a href=#content class=menu-button>Menu</a></li>");

Will work just fine, but

$( ".nav" ).append("<li class=tab home-tab><a href=#content class=home-button>Home</a></li>");

Will not out put the correct html. The html captures the tab class but not the home-tab class.

Is there a way to fix this?

Answer Source

Maybe using single quotes will work

$( ".nav" ).append("<li class='tab home-tab'><a href='#content' class='home-button'>Home</a></li>");
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download