jQuery-动态创建表并添加锚标记不会将锚显示为链接 [英] JQuery- creating a table dynamically and adding a anchor tag is not showing anchor as link

查看:69
本文介绍了jQuery-动态创建表并添加锚标记不会将锚显示为链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Jquery的新手.

I am newbie to Jquery.

我有一个ajax调用来获取数据和链接.我必须在动态创建的表中显示该数据.在每个表格行中,我需要显示带有定位标记的网址.

I have an ajax call that fetches the data and links. I have to show that data in a dynamically created table. In each table row, i would need to show the url with the anchor tag.

我面临的问题是:

由于动态创建了定位标记并且链接无法正常工作,因此添加定位标记未显示为链接.

The add anchor tag is not showing as a link as the anchor tag is dynamically created and the links are not working.

   $('#jsp-data-header').append('<tr><th colspan="2">Functionalities of the Resource</th></tr>');
   $('<tr/>').appendTo($('#jsp-data-header'))
        .append($('<th/>').text('JSP files'))
        .append($('<td/>').text("<a href='"+tempurl+"'>"+tempurl+"</a>")); 

如何使它显示为链接,然后单击链接应将我带到提到的网址.

How to make this appear as link and clicking on the link shouls take me to the url mentioned.

请提出建议.

推荐答案

.append($('<td/>').html("<a href='"+tempurl+"'>"+tempurl+"</a>"));

这篇关于jQuery-动态创建表并添加锚标记不会将锚显示为链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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