For the phone, you can just do a regex:

var p = '9999999999';
p.replace(/(\d{3})(\d{3})(\d{4})/, "($1) $2-$3")

On Apr 2, 11:18 am, Charlie Griefer <charlie.grie...@gmail.com> wrote:
> nice! :)
> um... err... I've actually got a need to take a 10 digit number and convert
> it to US phone format (e.g. 9999999999 becomes (999) 999-9999).  Any chance
> of whipping that up? :)
>
> I did look at the plugin you just posted, thinking I could tweak it to fit
> my needs.  But it's a bit over my head :\
>
> On Thu, Apr 2, 2009 at 11:04 AM, mkmanning <michaell...@gmail.com> wrote:
>
> >http://plugins.jquery.com/project/currencyFormat
>
> > On Apr 2, 9:58 am, Adam <adambu...@gmail.com> wrote:
> > > I am trying to manipulate a simple value (text node) which is a home
> > > price from 123456789 to be 123,456,789. Anyone have a resource?
> > > Thanks!
> > > -Adam
>
> --
> I have failed as much as I have succeeded. But I love my life. I love my
> wife. And I wish you my kind of success.

Reply via email to