locked
How do I make it select the text with android and ipad when clicking a textbox RRS feed

  • Question

  • User-858993849 posted

    I have the onFocus = this.select() for my textboxes. It works fine for the desktop browsers, but for PDA's, the text is never selected when you select a textbox.  How do I fix that?

    Friday, July 13, 2012 9:03 AM

Answers

  • User1943143334 posted

    Hi,

    Instead of onfocus you can try onclick!

    You can try the original code, which you are using - this.select();


    Hope it helps u...

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, July 16, 2012 10:55 AM

All replies

  • User-661350001 posted
    this.selectionStart=0; 
    this.selectionEnd=this.value.length; 

    using jquery
    $('#out').focus(function(){ $('#out').select(); }); 

    Friday, July 13, 2012 9:37 AM
  • User-858993849 posted

    Can you be more specific!  I tried the following:

    with a textbox I created:

     <asp:TextBox id="AddressTextbox" style="Z-INDEX: 352;  LEFT: 460px; POSITION: absolute; TOP: 330px" CssClass="textboxMain" EnableTheming = "false" 
            				runat="server"  Width="309px" onFocus="this.selectStart=0; this.selectionEnd.value.length();" AutoPostBack="false"></asp:TextBox>

    Then in script I placed:

     $('#out').focus(function () { $('#out').select(); });
     
    What did I do wrong?
     
    Thanks again!

    Friday, July 13, 2012 3:03 PM
  • User1943143334 posted

    Hi,

    Instead of onfocus you can try onclick!

    You can try the original code, which you are using - this.select();


    Hope it helps u...

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, July 16, 2012 10:55 AM