how to get caption in the textbox in css or javascript or php

Hi Everyone,
I have attached 3 sample images . i would like to understand how to have caption text in the textbox and when cursor inserted in the text box it vanished.

And a search button inside the textbox itself. you may notice ee also using it .(check the image)
further more if the textbox is not filled up correctly you notice(" ! ")inside the textbox.. (check the images attached )

is that done via css or  html or javascript .or php. need example so i can implement

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Kyle HamiltonData ScientistCommented:
for search input you have a couple options. you could go with html5, but it only works in modern browsers (ie10+) and the appearance will be dictated by the browser.
<input id="mysearch" type="search" />

or, you write it with css and use a background image of a magnifying glass inside the input.

for the exlamation marks, that's called validation, and you can do it clientside via javascript. if you're using jquery, then the validate plugin is the most ubiquitous. the appearance of erroneous fields (incldung the !) is set via css.

if you. eed a more specific solution, please post a link to your page
javeedabdulAuthor Commented:
Please provide me example or sample code.. in jquery and CSS for 3 issues..

The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

Kyle HamiltonData ScientistCommented:
there are plenty of examples on the web. you need to find something that is close to what you want to acheive, create a page or a jsfiddle, and share the link. as the asker of the question it is your responsibility to do the leg work.
Kyle HamiltonData ScientistCommented:
at an absolute minimum, you need to provide a page with input fields, and a reference to jquery, as well as the icons you would like to use fir the search field and the error states. makes this very easy.
javeedabdulAuthor Commented:
Kyle/Gary thanks

got one issue resolved.

search (zoom logo)and its functionality still couldn't work out.
and plus the (!) as mentioned in the pic..

yes i am working on it.. design just finished now i am on the coding side ..
The zoom image is just a simple image placed after your input box - it's nothing special
And Kyle has already told you about the jquery validations for indicating a field is wrong.
javeedabdulAuthor Commented:
I am looking for coding.. thought the zoom is the image thing. i am unable to figure out how to code the background image to work as search query when clicked.

validation is cool too but if i see the code of an existing one or plugin perhaps i can use it on the site

i am unable to post the link as its for personal customer where i am working on design and try to get in coding may take some time to understand once i know how .

appreciate your input
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.