Skip to content Skip to sidebar Skip to footer

Link Fill Script In Input Form

I have a script that fills in certain links when you click on them in an input form. But i am having one issue. For some reason i specified the links to call the class linkText and

Solution 1:

Change html() into text()

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

or this one:

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

​

Solution 2:

You are placing the html of parent element into the text box.

Instead you should use the following code that injects the value of the linked that is clicked

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

Solution 3:

You can also use just

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

Post a Comment for "Link Fill Script In Input Form"