Reputation: 51
I'm trying to reset the form when the user click on the back button. Here is the code that I use.
<input type="text" name="name">
<input type="text" name="email>
...
$(function() {
$('input[type=text]').attr('val', '');
});
This code is not working on Safari 6.0.2. I notice that the page load event is not even fired when the user click on the back button.
What could be the problem ?
Upvotes: 0
Views: 1220
Reputation: 120
There's no val
attribute. Use the val
method instead:
$(function() {
$('input[type=text]').val('');
});
And, you missed a quote at the email
field:
<input type="text" name="email>
^ Insert a quote here
Upvotes: 2