Solved

Using MVC How Do You Show Light Itacics Text in a Text Box?

Posted on 2014-09-22
2
124 Views
Last Modified: 2014-09-25
Using MVC how do you show light Italics text in a text box that goes away after you type?

Is there a way to use a placeholder?

Thanks,

Dan
0
Comment
Question by:danielolorenz
2 Comments
 
LVL 12

Accepted Solution

by:
Ramkisan Jagtap earned 500 total points
ID: 40338366
Yes, You can  do it using placeholder.
There's an option with HTML 5 to specify a placeholder.

<input name="name" type="text" placeholder="Your name...">
@Html.TextBoxFor(m => m.Name, new { placeholder="Your Name..." })

How ever this is not supported in all the browser so you can do it using java script. Please check the link below:
https://github.com/mathiasbynens/jquery-placeholder

If you are using Ajax Toolkit in your project you can do it using TextBoxWatermark
http://www.ajaxcontroltoolkit.com/TextBoxWatermark/TextBoxWatermark.aspx
0
 

Author Closing Comment

by:danielolorenz
ID: 40344261
Thanks
0

Featured Post

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

There are a couple ways to attach a JavaScript function to dynamically created elements. You can make a new script for each element as it’s created or you can use delegation. Delegation allows a single script that is added at page creation to mat…
Introduction Chart.js, used properly, can visually add a difference to your charting applications. It engages your visitors and allows them to interact with data they otherwise wouldn't be able to without expensive and complicated systems. For this…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question