-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
javascript:void(0) in <a> is breaking the placeholder #74
Comments
Same situation here. I've found only one solution: <a href="#">...</a> $("a").on("click", function(e)
{
e.preventDefault();
doSomething();
}); |
Why is this issue happens? Is it unfixable? I prefer to use |
I'm seeing the same thing. |
I'v got same problem: focus the textbox and hit twice ESC or click the anchor that href prop is set with 'javascript:void(0);', that will clear all of the placeholder. |
hi, anyone succeeded in working this out?? |
Its 2014 and the issue still happing! :/ |
Why not just use a .button-link {
background: transparent;
border: 0;
color: blue;
padding: 5px;
text-decoration: underline;
} <button type="button" onClick="doSomething()" class="button-link">test</button> 😃 Edit: also there's a PR #170 that claims to solve this. I haven't tried it myself, but maybe you guys can try it out and see if it solves your issue? If so, let me know. |
Maybe something along the lines of : var last_clicked;
$("body").on('click', 'a', function() {
last_clicked = this;
});
// Clear placeholder values upon page reload
$(window).bind('beforeunload.placeholder', function(e) {
if (last_clicked && last_clicked.href !== 'javascript:void(0)') {
$('.'+settings.customClass).each(function() {
this.value = '';
});
}
}); might work... |
I can confirm this behavior is still occurring in IE9, Aug 2015. Regarding the link Sangdol posted giving a positive reason for using javascript:void(0), deeper in that answer it's suggested that best practice is to simply not have an href attribute, which I found to be a workable solution. |
Still happening on IE9. |
Using |
I've fixed this in this commit: 891fa63 Full file is here: I tested it myself and with this, it is fixed. Can any of you test the fix to confirm it? |
Not working, some behavior happening with v2.2.0 |
@RASMiranda the fix is not in v2.2.0 yet. Try including this https://github.com/mathiasbynens/jquery-placeholder/blob/gh-pages/jquery.placeholder.js in your script. I'm waiting to fully confirm before releasing the fix in a future release. |
@amerikan Ha didn't realised it was not realeased, tried with https://github.com/mathiasbynens/jquery-placeholder/blob/gh-pages/jquery.placeholder.js same behavior :-/ |
When you click on a link that use javascript:void(0) as the href, the placeholder disapear in IE7 & IE8 (maybe others too)
The text was updated successfully, but these errors were encountered: