user1144271
user1144271

Reputation: 35

Create Hyperlink, add to body and then Add string beside Hyperlink

I want to create a Hyperlink using Jquery with name "Dashboard" and then add label beside hyperlink with name " >> Category".

So, basically my string would be like " Dashboard >> Category " with dashboard underlined.

How can I do this using Jquery ?

Upvotes: 0

Views: 43

Answers (1)

Samo
Samo

Reputation: 8240

var link = $('<a>Dashboard</a>')
  .appendTo($('body'));


$('<label>&nbsp;&gt;&gt; Category</label>').insertAfter(link);

But as David Thomas points out, label is probably not the best tag to use for this. Try <span> instead.

var link = $('<a>Dashboard</a>')
  .appendTo($('body'));


$('<span>&nbsp;&gt;&gt; Category</span>').insertAfter(link);

Upvotes: 2

Related Questions