Skip to content
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

Placeholder text is being submitted with the form #254

Closed
ghost opened this issue Apr 20, 2015 · 8 comments
Closed

Placeholder text is being submitted with the form #254

ghost opened this issue Apr 20, 2015 · 8 comments

Comments

@ghost
Copy link

ghost commented Apr 20, 2015

I'm using onclick handlers on an image (I know, this is bad code -- it is legacy code I'm stuck with) that submits the page's form. The placeholder shows up perfectly, but when I submit without changing the placeholder text (in my case "Enter your notes...") shows up in the notes section of the form. I've seen similar issues like this, but no good solutions -- please help!

@inspire22
Copy link

I'd been having this issue with IE10/11 lately, and am using this coffeescript as a workaround:

  fix_ie10_placeholder = ->
    return unless navigator.userAgent.match /Trident\/6\.0|Trident.*rv\:11\./ 
    console.log("fixing ie 10/11 placeholder text turbolinks bug")

    $('textarea').each ->
      if $(@).val() == $(@).attr('placeholder')
        $(@).val ''

@stukalin
Copy link

stukalin commented Jul 2, 2015

Created a pull request for that. #265 Give it a try, maybe it'd help you.

@ghost
Copy link
Author

ghost commented Jul 2, 2015

Thanks -- I'll give it a go and let you know how it works out.

@stukalin
Copy link

stukalin commented Jul 2, 2015

Ah, was wrong. The timeout should be longer. Like 1000 or even 2000

@amerikan
Copy link
Collaborator

amerikan commented Jul 2, 2015

Have you tried using the version on latest commit? https://github.com/mathiasbynens/jquery-placeholder/blob/gh-pages/jquery.placeholder.js it's not minimized, but that's the latest and many bugs were fixed.

@stukalin
Copy link

stukalin commented Jul 3, 2015

Yeah, but this

 setTimeout(function() {
                    $inputs.each(setPlaceholder);
                }, 10);

didn't work for me until I increased this to 1-2 sec

@amerikan
Copy link
Collaborator

amerikan commented Jul 7, 2015

@inspire22 that should not be the case. The plugin should not even activate on IE 10/11 since those versions already support placeholder attribute natively.

@amerikan
Copy link
Collaborator

duplicate of #244

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants