JSFiddle - React, Tailwind, and code Playground

HTML

<a href="search.php" onclick="return false;">search</a><br>
<button onclick="alert(document.body.innerHTML)">Show HTML</button>

JavaScript

$(function () {
var accounts = [
    ['user1', 'password'],
    ['user2', 'passowrd']
]

function html(){
    var button = '<a href="#" id="switchacc">Switch User</a>&nbsp;• &nbsp;';
$('a[href=search.php]').eq(0).before(button);

    $('#switchacc').click(function(){
        $(this).html('<select id="accounts">'+ accountss +'</select>');
        return false;
    });

    var accountss = '';
    for(i = 0; i <= accounts.length; i++){
        accountss = accountss + '<option name="' + accounts[i][0] + '" value="' + i + '">' + accounts[i][0] + '</option>';
    }   
}
html();
})