Changing an input’s HTML5 placeholder color with CSS does not work on Chrome

You forget a :. Because of that, the whole selector got corrupted and didn’t work. Edit: Seems like (after an update?) this doesn’t work anymore, try this: input::-webkit-input-placeholder{ color:red; } input:-moz-placeholder { color:red; } Note: don’t mix the vendor prefix selectors (-moz, -webkit, -ms, …). Chrome for example won’t understand “-moz-” and then ignores … Read more

How do I put hint in a asp:textbox

The placeholder attribute You’re looking for the placeholder attribute. Use it like any other attribute inside your control: <asp:textbox id=”txtWithHint” placeholder=”hint” runat=”server”/> Don’t bother about your IDE (i.e. Visual Studio) maybe not knowing the attribute. Attributes which are not registered with are passed through and rendered as is. So the above code (basically) … Read more

How to add placeholder attribute to JSF input component?

I thought everything that was not JSF was passed to the browswer for rendering? This assumption is thus wrong. Unspecified component attributes are ignored by the JSF renderers. You have basically the following options to get it to work: If you’re already on JSF 2.2 or newer, set it as a passthrough attribute. <… xmlns:a=””> … Read more

java swing JTextField set PlaceHolder [duplicate]

Try this class: package playground; import java.awt.*; import javax.swing.*; import javax.swing.text.Document; @SuppressWarnings(“serial”) public class PlaceholderTextField extends JTextField { public static void main(final String[] args) { final PlaceholderTextField tf = new PlaceholderTextField(“”); tf.setColumns(20); tf.setPlaceholder(“All your base are belong to us!”); final Font f = tf.getFont(); tf.setFont(new Font(f.getName(), f.getStyle(), 30)); JOptionPane.showMessageDialog(null, tf); } private String placeholder; public … Read more