简体   繁体   中英

add href link to <a> Tag in css

I have dynamic table .in which data populates from 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

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

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.

You should rather use javascript or jquery to do that after appending the DOM.

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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