not able to set ID's to dynamically created labels in JQUERY
css, dom, html, javascript, jquery
Solution
You need to use `lbl.prop("id","test")` since you have initiated `lbl` as a jQuery element rather than a javascript/DOM element so it does not have the `id` property.
Problem
i created a label dynamically in jquery. I need to assign certain styles to that label. Here i tried to assign a unique ID to that label and apply styles. But it's not working. my code is; Javascript ``` var lbl = $("<label>").text('Welcome'); lbl.id = "test"; $("#sec").append(lbl); ``` CSS ``` #test { color:red; font-size:20px; } ``` how to assign ID's to dynamic labels?