简体   繁体   English

<a>在CSS中</a>添加href链接到<a>Tag</a>

[英]add href link to <a> Tag in css

I have dynamic table .in which data populates from DB asHyperlink Records 我有动态表.in数据从DB asHyperlink Records填充

this is script: 这是脚本:

function getErrorStatusList() {
});
$.ajax({
   // parameters
    success: function (response) {
//Data gets in response
var output = "<table class='table'><tr><th>MZillaID</th></tr>";

        for (var x = 0; x < obj.length; x++) {

            output += "<tr><td class='myclass' style='text-decoration:underline;'>" + obj[x].EMID + "</td></tr>";
        }

        output += "</table>";
        $("#result").append(output);

    },

});

this is working Fine .this records generated to hyperlink in Output HTML 这工作正常。这个记录生成为输出HTML中的超链接

as

<a href="http://mzillaint.nokia.com/show_bug.cgi?id=87774">87774</a>

..I want to put this on Css.I mean add "a" tag in css and put href in it ..我想把它放在Css上。我的意思是在css中添加“a”标签并将href放入其中

like 喜欢

a
{
    href://link which generated 

}

I Tried But this is not implementing ..How Can I do it ??Any suggestion would be Helpful 我试过但这不是实施..我怎么能这样做?任何建议都会有所帮助

It is absolutely not possible. 绝对不可能。 You can not modify DOM using CSS as CSS is display only. 您无法使用CSS修改DOM,因为CSS仅显示。

You should rather use javascript or jquery to do that after appending the DOM. 在添加DOM之后,您应该使用javascript或jquery来执行此操作。

 $("#result").append(output);
 $("#result a").attr('href',generated_link_here);

您可以使用JavaScript来实现$('a')。attr('href',' http: //mzillaint.nokia.com/show_bug.cgi?id = 87774 ');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM