Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9007787
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:46:58+00:00 2026-06-16T01:46:58+00:00

For other browsers, simply setting #input-element { color: red; } is sufficient to also

  • 0

For other browsers, simply setting #input-element { color: red; } is sufficient to also color an input’s placeholder text (<input type="text" placeholder="foo" />).

However, this is not the case on iOS; which requires the following instead (perhaps more appropriate, but still):

#input-element::-webkit-input-placeholder { color: red; }

Fine, that’s no problem. However, I’m trying to do this with jQuery, without much success. I’ve tried the following:

$("#input-element::-webkit-input-placeholder").css('color', 'red');
$("#input-element").css('::-webkit-input-placeholder', 'color: red'); // not according to .css documentation: I'm aware

However, none of these did any change. I’m trying to avoid appending ($(head).append("<style>.."); the style directly to the document.

How to change an input’s placeholder style-attributes trough jQuery – maintaining iOS compatibility?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T01:46:59+00:00Added an answer on June 16, 2026 at 1:46 am

    Why not just toggle a CSS class?

    CSS:

    input[type=text]::-webkit-input-placeholder { color: red; }
    
    .blue-pl::-webkit-input-placeholder {
        color: blue !important;
    }
    

    JavaScript:

    $('#input-element').click(function(){$(this).addClass('blue-pl'); });
    

    This worked on my iOS 6 iPhone.

    jsFiddle demo

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am not sure if this issue exists in other browsers; however, if I
I have a very simple example jsfiddle : HTML: <input type=text/> <input type=text value=aaa/>
In other browsers no problem at all. But in chroom when i hover on
This works in all other browsers and I have no idea what the problem
I sometimes need to debug JS in other browsers, and it would be really
Firstly, when I say other browsers I really only mean Firefox because that's all
I have some login code that works well for Firefox and other browsers, but
Picture says 1000 words: http://d.pr/ZeBI Basically in most other browsers, when focus on the
I don't know what happened to my Firefox (other browsers working fine). I tried
What's the best way to have separate CSS for IE and other browsers? I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.