Trim first digit if its 0 validation help |
[eluser]Innovative[/eluser]
Hi, I am beginner so need your help. I have a form with phone field, if the user enters 0 as first digit then i need to trim that 0 when the field looses focus and also a gmail like or any fancy alert informing abt the change is to be accomplished. Pls suggest.
[eluser]LuckyFella73[/eluser]
Javascript has no trim function but you can get the same effect by using the function below. Source: http://www.evocomp.de/beispiele/javascript/trim.html (german site) Code: <scr+ipt language="javascript" type="text/java+scr+ipt"> Try onblur event in your form
[eluser]VladSun[/eluser]
[quote author="Thomas Hunter" date="1258143538"]Add zero to it. 005 + 0 = 5[/quote] It would work in PHP, but not in JS (because + is also the concatenation operator) Usually, I multiply by 1, or subtract 0.
[eluser]Phil Sturgeon[/eluser]
Typecasting guys. Code: echo '005'; // 005
[eluser]VladSun[/eluser]
[quote author="Phil Sturgeon" date="1258152201"]Typecasting guys.[/quote] It's JS, Phil ![]()
[eluser]Innovative[/eluser]
Thanks for all ur comments. Also can anyone suggest me abt jQuery fancy alert
|
Welcome Guest, Not a member yet? Register Sign In |