How to use the JQuery trim() function into normal Javascript file?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • varunkumarid
    New Member
    • Aug 2008
    • 40

    How to use the JQuery trim() function into normal Javascript file?

    Hi to all

    I am using following line code to trim the unwanted space in string on client side whatever the enduser will type into the textbox

    Collapse
    Code:
    if(document.getElementById("txtUserName").value.trim() == ""){
           ..........
           ..........
    }
    when this line execute by the browser on clinet side

    it shows the error "Object doesn't support this property or method Error"

    How to use the trim() function in javascript

    Please Help me

    Thanks in Advance...
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    I rather suspect you call that before the element is created in the DOM.

    PS. you code has nothing to do with jQuery

    Comment

    Working...