How do I auto-hide placeholder text upon focus using css or jquery?

Edit: All browsers support now input:focus::placeholder { color: transparent; } <input type=”text” placeholder=”Type something here!”> Firefox 15 and IE 10+ also supports this now. To expand on Casey Chu’s CSS solution: input:focus::-webkit-input-placeholder { color:transparent; } input:focus:-moz-placeholder { color:transparent; } /* FF 4-18 */ input:focus::-moz-placeholder { color:transparent; } /* FF 19+ */ input:focus:-ms-input-placeholder { color:transparent; } … Read more

Add placeholder text inside UITextView in Swift?

Updated for Swift 4 UITextView doesn’t inherently have a placeholder property so you’d have to create and manipulate one programmatically using UITextViewDelegate methods. I recommend using either solution #1 or #2 below depending on the desired behavior. Note: For either solution, add UITextViewDelegate to the class and set textView.delegate = self to use the text … Read more

Use Font Awesome Icon in Placeholder

If you’re using FontAwesome 4.7 this should be enough: <link href=”https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css” rel=”stylesheet”/> <input type=”text” placeholder=”&#xF002; Search” style=”font-family:Arial, FontAwesome” /> A list of hex codes can be found in the Font Awesome cheatsheet. However, in the lastest FontAwesome 5.0 this method does not work (even if you use the CSS approach combined with the updated font-family).

Adding placeholder text to textbox

Wouldn’t that just be something like this: Textbox myTxtbx = new Textbox(); myTxtbx.Text = “Enter text here…”; myTxtbx.GotFocus += GotFocus.EventHandle(RemoveText); myTxtbx.LostFocus += LostFocus.EventHandle(AddText); public void RemoveText(object sender, EventArgs e) { if (myTxtbx.Text == “Enter text here…”) { myTxtbx.Text = “”; } } public void AddText(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(myTxtbx.Text)) myTxtbx.Text = “Enter text … Read more

Input placeholders for Internet Explorer

In looking at the “Web Forms : input placeholder” section of HTML5 Cross Browser Polyfills, one I saw was jQuery-html5-placeholder. I tried the demo out with IE9, and it looks like it wraps your <input> with a span and overlays a label with the placeholder text. <label>Text: <span style=”position: relative;”> <input id=”placeholder1314588474481″ name=”text” maxLength=”6″ type=”text” … Read more

Placeholder in IE9

HTML5 Placeholder jQuery Plugin – by Mathias Bynens (a collaborator on HTML5 Boilerplate and jsPerf) https://github.com/mathiasbynens/jquery-placeholder Demo & Examples http://mathiasbynens.be/demo/placeholder p.s I have used this plugin many times and it works a treat. Also it doesn’t submit the placeholder text as a value when you submit your form (… a real pain I found with … Read more

Placeholder in UITextView

I made a few minor modifications to bcd’s solution to allow for initialization from a Xib file, text wrapping, and to maintain background color. Hopefully it will save others the trouble. UIPlaceHolderTextView.h: #import <Foundation/Foundation.h> IB_DESIGNABLE @interface UIPlaceHolderTextView : UITextView @property (nonatomic, retain) IBInspectable NSString *placeholder; @property (nonatomic, retain) IBInspectable UIColor *placeholderColor; -(void)textChanged:(NSNotification*)notification; @end UIPlaceHolderTextView.m: #import … Read more