在输入表单中链接填充脚本 [英] Link Fill Script in input form

查看:111
本文介绍了在输入表单中链接填充脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个脚本,当您在输入表单中单击某些链接时,它们会填写这些链接.

I have a script that fills in certain links when you click on them in an input form.

但是我有一个问题.

出于某种原因,我指定了用于调用类 linkText 的链接,并指定了单击时在输入文本字段中显示的某些值.

For some reason i specified the links to call the class linkText and specified certain values to be displayed in the input text field when clicked.

但是由于某种原因,整个链接都会显示出来,包括类和值.

But for some reason the whole link will show including the class and value.

例如,它将显示<a class="linkInsert" value="This Value">HTML Link (websites / blogs)</a>

而不是我想要的值"This Value"

我只想显示该值,但它显示整个代码.

I just want the value to display but it displays the whole code.

您可以在这里看到我的意思 jsFiddle

You can see what i mean here jsFiddle

推荐答案

将html()更改为text()

Change html() into text()

$('a.linkInsert').click(
    function(e){
        e.preventDefault();
        $('#linkText').val($(this).parent().text());
    });

或这个:

$('a.linkInsert').click(
    function(e){
        e.preventDefault();
        $('#linkText').val($(this).attr('value'));
    });

​

这篇关于在输入表单中链接填充脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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