I have a problem to simply clear TextBox text ... I am using asp.net and bit of JS for project.
But it seems Mozzila is to strong for my code and now it's bugging me.
Idea is simple ... user can log in, and as always mozzila ask "Save credentials" which is fine
But if user forget his password, select the link, I send him mail with URL, he comes back to new page which got text boxes
And for some reason Mozzila see my first TextBox as the one it "remembered the credentials"
So i tried next things
<script type="text/javascript">
$(document).ready(function () {
document.getElementById("MainContent_txtNewPass1").value = "";
document.getElementById("MainContent_txtNewPass2").value = "";
});
</script>
And
protected void Page_Load(object sender, EventArgs e)
{
txtNewPass1.Attributes["AUTOCOMPLETE"] = "off";
txtNewPass2.Attributes["AUTOCOMPLETE"] = "off";
txtNewPass1.Text = "";
txtNewPass2.Text = "";
}
Which didn't worked, as I wouldn't be asking this question ... IDs of those asp:TextBoxes are different, I don't understand why is this happening or how to stop it from happening?
EDIT
I am sure it's problem with Mozzila credential saving, as once I delete saved password, problem is gone. But at the end of a day, i just want to clear that TextBox.Text
SOLUTION
If anyone gets a same problem ... I solved it but using
window.onload = function () {
document.getElementById("MainContent_txtNewPass1").value = "";
document.getElementById("MainContent_txtNewPass2").value = "";
}
Instead $(document).ready(function () {