Passing value from function to other function as selector value

Passing value from function to other function as selector value

Hi all,
I have problem with following script:
  1. $(document).ready(function(){
    id = 'test';
        $('#Name').keyup(function(){
              id = '#Mobil';
        });



  2.      $(id).click(function(){
             console.log(id);
        });
    });


Console.log has right value "#Mobil" but $(id) is using value "Test". I need there value "#Mobil" like console.log has. Thx for help.
    • Topic Participants

    • chbox