Jake
Jake

Reputation: 461

JQuery - Click Link Auto fill in input field

I got a bit of a pickle.

What im trying to do is click on a link and it automatically puts a value into an input field.

I have an quicksearch table that auto sorts when you type something in the search box. I want to be able to click a link with a specific name that automatically puts that value in the search field.

So far i have this

$(document).ready(function() {

$('#test').click(function() {
    $('.qs_input').val( $(this).text() ).keyup();
    return false;

    });

});

Cheers,

Upvotes: 0

Views: 4433

Answers (1)

Šime Vidas
Šime Vidas

Reputation: 185893

This should do it:

$('#yourLink').click(function() {
    $('#yourInput').val( $(this).text() ).keyup();
    return false;
});

Upvotes: 3

Related Questions