If you've got control over the back end, you could do the upper case
transform on the server side...but like I said. I think you've got it as
stripped down as you can get it. 

-----Original Message-----
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of jckos
Sent: Wednesday, May 13, 2009 12:36 PM
To: jQuery (English)
Subject: [jQuery] Re: Better way to trim whitespace from input?


Thanks.  I can't use CSS because it doesn't actually submit the value as
uppercase, which is what I need.



On May 13, 1:03 pm, "Andy Matthews" <li...@commadelimited.com> wrote:
> Well, you could try using a text transform CSS attribute on the text
field.
> Then you wouldn't have to perform a toUpperCase using JavaScript. But 
> other than that, looks about as lean as you can get it.
>
> andy
>
> -----Original Message-----
> From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] 
> On
>
> Behalf Of jckos
> Sent: Wednesday, May 13, 2009 11:53 AM
> To: jQuery (English)
> Subject: [jQuery] Better way to trim whitespace from input?
>
> Hi,
>
> I need to transform all characters entered in an input field to 
> uppercase and trim trailing whitespace.  This script works, but I'm 
> wondering if there's a better way to do it.
>
>      <script>
>          $(document).ready(function(){
>                 $("input").keyup(function (e) {
>                 $("#couponCode").val($(this).val().toUpperCase());
>               });
>            $("button").click(function () {
>                         var couponCode = $("#couponCode").val();
>                         couponCode = jQuery.trim(couponCode);
>              });
>            });
>         </script>
>
> Any suggestions?
>
> Thanks in advance.


Reply via email to