Marverick M. Marverick M. - 23 days ago 9
CSS Question

reset textbox password using javascript

I have this textbox with the button and submitting the data using ajax

<input type="password" id="password" />
<button id="addaccount" onclick="showload();">Add</button>


the showload(); indicates the loading of the page, it shows the pure white background with 50% opacity on it and a loading .gif in the center.

now how can I reset the password textbox in the javascript?

$(document).ready(function(){
$("#addaccount").click(function(){
var password = $("#password").val();
$.ajax({
method: "POST",
url: "auth_adduser.php",
data: {
password:password
},
success: function(data){
$("#successresult").html(data);
}
});

});
});


thanks in advance

Answer

After succesfull ajax execution $("#password").val(""); reset password

$(document).ready(function(){
    $("#addaccount").click(function(){
        var password = $("#password").val();
            $.ajax({
                method: "POST",
                url: "auth_adduser.php",
                data: {
                    password:password
                    },
                success: function(data){
                    $("#successresult").html(data);
                  $("#password").val("");
                }
            });

    });
});
Comments