嘿,我正在尝试做到这一点,所以当您单击现有的a href =时,它会将内部文本粘贴到文本方面。当然,如果单击href,它将导致链接,因此我做到了,因此它将取出HREF。到目前为止,我有此代码
$(function(){
$(".username a").removeAttr("href").css("cursor","pointer");
var $paste = $('div.post h4 .username a span');
$paste.click('')
});
好吧,我想那是一个很好的开端大声笑。对我的问题是,我不知道如何添加onclick ="或其他任何使函数在单击上工作的方法吗?或者会。一般的工作。当然,我需要在.Blick区域进行功能。我不知道在那里放置什么来创建标签内部的文字...有人可以帮助我,如果您使用。去。
$(function(){
$('.username a').click(function(){ return false; });
$('.username a').one('click', function(e){
//e is short for event
e.preventDefault(); //will no longer follow through
//You want to append the text of the anchor link into the textarea.
var innerTxt = $(this).text();
//need to trim whitespace from the string
innerTxt = $.trim(innerTxt);
var $obj= $('textarea'); //replace this with textarea selector
$obj.val(
$obj.val()+'n@'+innerTxt
);
});
});
尝试此
$(".username a").click(function(e){
//DO Wathever you want here
e.preventDefault();
})