user1050619 user1050619 - 18 days ago 5
HTML Question

Adding a label with div using Jquery

Im trying to add a div element that contains a label but it does not work

Can you please let me know how to fix it? My fiddle

html

<div id="first-tab">


js

$(document).ready(function(){
$( "#first-tab" ).append("<div><label for="name">Test</label></div>")

})

Answer

Working demo :) http://jsfiddle.net/d5Lqs/

Issue use ' doubles quotes were not used correctly.

code

$(document).ready(function(){
   $( "#first-tab" ).append('<div><label for="name">Test</label></div>');

});
Comments