Harry B. Harry B. - 10 months ago 45
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>");