Jquery event click after attribute change

0

I have a problem here with Jquery, when the button is clicked I need to get the value of the input and replace the 'href' attribute of one and at the same time click on it ... I'm not having results, I can do the part of overriding the value of the attribute, but I can not do the click event right after!

btnContacts = button

contactParams = input text

sendContact = Tag A

NOTE: this is not a FORM!

$(document).ready( function () {
            $('#btnContatos').click( function () {
                var contato = $('#contatoParams').val()
                //alert(contato)
                $('#enviaContato').attr('href', '/chat/busca/'+contato);

                // Mexer...
            })
        }
    
asked by anonymous 07.02.2018 / 11:57

1 answer

3

Using JS to call the new page:

$(document).ready(function(){
    $('#btnContatos').click(function(){
        var contato = $('#contatoParams').val();
        location.href = '/chat/busca/' + contato;
    });
});
    
07.02.2018 / 12:34