如何使用jquery将<a href="">添加到<p>?

时间:2019-06-12 10:35:45

标签: javascript jquery

我试图在下面显示的文本中添加一个href链接到“隐私策略”一词。

我尝试在行中添加<a href="">privacy policy</a>,也尝试了"see our " + "<a href="">privacy policy</a>" + " for..."

然后尝试制作一个包含链接的变量,并将其添加到上面的代码中:+ "<a href="">privacy policy</a>" +

但两者都不起作用,该行会消失。

jQuery(document).ready(function( $ ){
   $( ".classname" ).after( "<p>Your details will be used to process the tickets. We take users’ privacy very seriously, see our privacy policy for full details on how we use your data.</p>" );
});

有一种简单的方法吗?

****尝试输入密码****

jQuery(document).ready(function( $ ){
   $( ".classname" ).after( "<p>Your details will be used to process the tickets. We take users’ privacy very seriously, see our <a href="'https://google.com'" target="'_blank'" rel="noopener noreferrer">privacy policy</a> for full details on how we use your data.</p>" );
});
jQuery(document).ready(function( $ ){
   $( ".classname" ).after( "<p>Your details will be used to process the tickets. We take users’ privacy very seriously, see our <a href="https://google.com" target="_blank" rel="noopener noreferrer">privacy policy</a> for full details on how we use your data.</p>" );
});

0 个答案:

没有答案