Reputation: 387
I have a variable with HTML and CSS value . How Can I add another HTML element inside a <span >
element. Like if I want to take a <a>
element inside a <span>
element with different class?
var newSpan = $("<span></span>", {
title: "Double Click to Edit Groups Name",
id: "myInstance2",
style:"display:none; float:left;",
text: "Unnamed Group",
class: "title-span"
})
Upvotes: 1
Views: 75
Reputation: 10572
You can append content to that element:
newSpan.append("<a href='' class='fred'></a>");
Upvotes: 5