将 href 设置为超链接文本 [英] Setting href to Hyperlink text

查看:37
本文介绍了将 href 设置为超链接文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从数据库中获取以下文本,href 为空.

I am getting below text from database with href as null.

您还必须点击此链接.

我在页面加载时分配给标签的文本.我的要求是当我点击链接"时,我需要重定向到某个页面.我应该在哪里分配 href 值以及如何分配?

This text I am assigning to the label when page loads. My requirement is when I click the "link" I need to redirect to certain page. Where should I assign the href value and how?

推荐答案

如果您使用的是 jQuery,您可以使用以下代码设置 href:

If you are using jQuery you can set the href using the following code:

$("a").attr("href", "http://stackoverflow.com");

这篇关于将 href 设置为超链接文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆