placeholder

keep placeholder on focus in IE10

对着背影说爱祢 提交于 2019-11-27 04:09:27
Under WebKit and Firefox, the text in a input 's placeholder sticks around on focus —it doesn't disappear until input.val actually has something in it. Is there a good way to force IE10 to do the same thing? Kevin Hakanson The :-ms-input-placeholder pseudo-class documentation from the Internet Explorer Developer Center seems to imply this is working as designed. The placeholder text is displayed with the specified style until the field has focus, meaning that the field can be typed into. When the field has focus, it returns to the normal style of the input field and the placeholder text

How do I put hint in a asp:textbox

徘徊边缘 提交于 2019-11-27 04:08:39
How do I put a hint/placeholder inside a asp:TextBox? When I say a hint I mean some text which disappears when the user clicks on it. Is there a way to achieve the same using html / css? The placeholder attribute You're looking for the placeholder attribute. Use it like any other attribute inside your ASP.net 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 ASP.net are passed through and rendered as is. So the above code (basically) renders to:

input[type=number] placeholder color in FF29+

隐身守侯 提交于 2019-11-27 03:24:14
问题 <input type="text" placeholder="test" /> <input type="number" placeholder="test" /> How do I style it? :-moz-placeholder { color: red; opacity: 1; } ::-moz-placeholder { color: red; opacity: 1; } Why doesn't the global placeholder work on it, even though firebug shows it's applied? Is it a bug, is it an intention? http://jsbin.com/papad/1/edit?html,css,output 回答1: It's apparently a bug: Firefox 29.0 the ::-moz-placeholder css pseudo-element selector is not honored for with type="number"

jQuery change placeholder text color

此生再无相见时 提交于 2019-11-27 02:32:52
问题 Is it possible to use "::-webkit-input-placeholder" with jQuery to set a color for the placeholder text? Something like this: $("input::-webkit-input-placeholder").css({"color" : "#b2cde0"}); 回答1: You can't really modify pseudo-selectors with JavaScript. You'll have to modify an existing a <style> element. If possible, make a class: .your-class::-webkit-input-placeholder { color: #b2cde0 } And add it to the element: $('input').addClass('your-class'); 回答2: If you don't have a stylesheet , and

Replace multiple placeholders with PHP?

百般思念 提交于 2019-11-27 02:28:09
问题 I have a function that sends out site emails (using phpmailer), what I want to do is basically for php to replace all the placheholders in the email.tpl file with content that I feed it. The problem for me is I don't want to be repeating code hence why I created a function (below). Without a php function I would do the following in a script // email template file $email_template = "email.tpl"; // Get contact form template from file $message = file_get_contents($email_template); // Replace

java swing JTextField set PlaceHolder [duplicate]

拜拜、爱过 提交于 2019-11-27 01:58:09
This question already has an answer here: Java - placeholder on textfield 3 answers I create a JTextField and now i want to set the placeholder on that JTextField i don't Know how to set the placeholder on the JTextField? Please Help How to set Placeholder text on JTextField JTextField database=new JTextField("Enter Data Base Name"); database.setPreferredSize(database.getPreferredSize()); database.setText(""); That is my code to text field now in that code i want to set placeholder how to set a placeholder on that JTextField Peter Tseng Try this class: package playground; import java.awt.*;

Java - placeholder on textfield

元气小坏坏 提交于 2019-11-27 01:52:05
I'm trying to create a GUI with Swing. My problem is, I have a textfield, but I want it to have a "placeholder" (like in html). I read here and there that it can be done by overriding the paint() of the textfield. Since my code is generated I found out that I need to use the "Custom Creation Code" to override the code that was generated. Here is what I have put in the "Custom Creation Code" field new javax.swing.JTextField() { String test = super.getText(); String hint = "Username"; public void paint(Graphics g) { if ( test == null || test.length() < 1 ) { g.setColor( Color.red ); g.drawString

Java: String formatting with placeholders

谁说胖子不能爱 提交于 2019-11-27 01:04:18
问题 I am new to Java and am from Python. In Python we do string formatting like this: >>> x = 4 >>> y = 5 >>> print("{0} + {1} = {2}".format(x, y, x + y)) 4 + 5 = 9 >>> print("{} {}".format(x,y)) 4 5 How do I replicate the same thing in Java? 回答1: The MessageFormat class looks like what you're after. System.out.println(MessageFormat.format("{0} + {1} = {2}", x, y, x + y)); 回答2: Java has a String.format method that works similarly to this. Here's an example of how to use it. This is the

HTML5 image icon to input placeholder

▼魔方 西西 提交于 2019-11-27 00:46:10
问题 I'd like to add an image icon to an input placeholder, like in this picture: Please note that this is a placeholder, so when the user starts typing, the icon also disappears. I came with the following solution for webkit (Safari+Chrome) using ::-webkit-input-placeholder and ::before . Unfortunately, the straightforward application to mozilla seems not to work. So my question is: is there a cross-browser solution to add an image icon to an input placeholder? Solution for webkit: #myinput::

HTML Placeholder browser compatibility

南笙酒味 提交于 2019-11-26 22:22:39
问题 What browsers support the placeholder html tag for text inputs? Does Internet Explorer support it? (I have a JavaScript placeholder that I can use for the browsers that do not support it.) <input type=TEXT placeholder="placeholder here" /> 回答1: It is currently supported by all major browsers except IE 9 and earlier and Opera mini. For updates, look at the w3schools-specs Or even better, view this overview. 回答2: For anyone interested, this is the jQuery Fallback that I use I use it with jQuery