text in input box

Author Topic: text in input box  (Read 3341 times)

Offline abcdfTopic starter

  • Trade Count: (0)
  • Semi-Newbie
  • *
  • Thank You 2
  • Posts: 43
  • Karma: 2
text in input box
« 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


Offline Haywood

  • Trade Count: (0)
  • Newbie
  • *
  • Thank You 0
  • Posts: 1
  • Karma: 0
Re: text in input box
« Reply #1 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.

Offline Patrecia

  • Trade Count: (0)
  • Full Member
  • ***
  • Thank You 2
  • Posts: 104
  • Karma: 1
  • Gender: Female
    • local search marketing
Re: text in input box
« Reply #2 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.

Offline CMRaper

  • Trade Count: (0)
  • Semi-Newbie
  • *
  • Thank You 0
  • Posts: 31
  • Karma: 0
  • Gender: Male
    • Engineering and Technology Blog
Re: text in input box
« Reply #3 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.

Offline seo-webservices

  • Trade Count: (0)
  • Semi-Newbie
  • *
  • Thank You 1
  • Posts: 10
  • Karma: 0
Re: text in input box
« Reply #4 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


« Last Edit: 10-17-2013, 05:59:24 by seo-webservices »


 

Related Topics

  Subject / Started by Replies Last post
0 Replies
1783 Views
Last post 09-06-2011, 03:44:27
by Walalayo
2 Replies
2114 Views
Last post 05-25-2013, 03:58:50
by irfanyounas
0 Replies
907 Views
Last post 10-17-2014, 18:37:25
by chr2014
0 Replies
890 Views
Last post 12-19-2015, 02:51:59
by chinmay.sahoo
0 Replies
757 Views
Last post 03-18-2016, 23:40:25
by villadavid