Himaan Singh
Himaan Singh

Reputation: 707

link is not opening in new tab using <a href ></a>

this is a line of code that makes an item in mocel a url to external site but this is opening same tab not in a new tab.

little help would be much appreciated

<a href='@string.Format("url/{0}",item.hello)',target="_blank">@item.hello</a>

Upvotes: 0

Views: 73

Answers (2)

gavgrif
gavgrif

Reputation: 15519

remove the comma before the target and you should have the same quotes (either single or double) for all parts of the line of code and alternate them when required (such as in the body of the href as opposed to the start / end).

<a href='@string.Format("url/{0}",item.hello)' target='_blank'>@item.hello</a>

Upvotes: 1

Blazed
Blazed

Reputation: 309

You have use:

<a href='@string.Format("url/{0}",item.hello)', target="_blank">@item.hello</a>

You mustn't put , but here:

<a href='@string.Format("url/{0}",item.hello)' target="_blank">@item.hello</a>

Like you can see it work

link

Upvotes: 0

Related Questions