Seo Forum

Coding & Programming => PHP Forum => Topic started by: abcdf on 10-24-2011, 20:54:16

Title: text in input box
Post by: abcdf on 10-24-2011, 20:54:16
I dont know what this is called or even how to pull it off though im sure it doesn't require much. Anyway I have a form I found and I am using for my email to SMS project and had a cool and handy little tweak Id like to do and have seen on many other forms on the web. So there is an input box in my form that asks for a cell phone number, I would like to have "Without Dashes" in gray text displayed inside the input box then vanish when the user clicks the input box. How do I pull that off?

Thanks
Title: Re: text in input box
Post by: Haywood on 08-08-2013, 02:25:42
As we know for different people they use different kinds of mobile phone signals. Just as the people around you like your friends, your colleagues, your family members and so on, they may use the different mobile phone signals as now there are various mobile phone signals from different companies and of which the frequency bands are also different such as the CDMA, GSM, DCS, PCS, 3G, 4G LTE and 4G Wimax. So in different conditions and circumstances people are in need of the mobile phone jammers that of different frequency bands. But if people are in great need of a phone jammer via which they can decide the jamming frequency bands what kind of device should they choose? Of course, the adjustable phone jammer is the best for them in such condition.
Title: Re: text in input box
Post by: Patrecia on 08-22-2013, 13:17:24
Good question my friend as something same was happening to me also and I did have the same questions but the awesome replies have helped me a lot really great one.The second reply is my favorite and I really love it thanks for the post keep updating my friend.
Title: Re: text in input box
Post by: CMRaper on 09-15-2013, 18:44:23
Hmm. just use javascript. Then on the onclick event of the text box do something like

var text = document.getElementById("txtnumber").value;
if (text!="Without Dashes"){
     document.getElementById("txtnumber").value = "";
}

Post Merge: 09-15-2013, 18:45:03

Java script or any client side scripting language you use, jquery will do also.
Title: Re: text in input box
Post by: seo-webservices on 10-17-2013, 05:56:34
Hi,

I think you already has a default value for your textbox like this:

<input name="xхx" value="abcdefg">

now you should see the on focus event on your input box:
<input name="xхx" id="xхx" value="abcdefg"  onfocus="hidevalue()">


<script type="text/javascript">
function hidevalue(){
    if(document.getElementbyId("xхx").value=="abcdefg"){
            document.getElementbyId("xхx").value="";
    }
}

</script>



Cheers
Nick