Edit in JSFiddle

function changeInputType(inputId, type) {
    var input = $("#" + inputId);
    $(input).replaceWith($("<input />").val(input.val()).attr("placeholder", input.attr("placeholder")).attr("id", inputId).attr("type", type));
}

$("#show-ps").change(function() {
    if ($(this).attr("checked")) {
        changeInputType("password", "text");
    } else {
        changeInputType("password", "password");
    }
});

if ($("#show-ps").attr("checked")) {
    changeInputType("password", "text");
}
form{margin:25px;}
      <form class="login" action="foo">
        <input id="username" type="text" placeholder="ユーザー名" />
        <input id="password" type="password"  placeholder="パスワード"/>
        <input id="submit" type="submit" value="ログイン" />
        <br />
        <input id="show-ps" type="checkbox" /><label for="show-ps">パスワードを表示</label>
    </form>