SelectText not working in Google Chrome : Request for Solution

  1. #1

    SelectText not working in Google Chrome : Request for Solution

    We are facing one issue with selectText usability in our application. Currently it is able to highlight the text in browser Internet Explorer[Version 1607(OS Build 14393.5582)] but not working in Google Chrome[Version 108.0.5359.125 (Official Build) (64-bit)]. We are successfully able to fetch and pass the index values of the text in Google chrome browser. Kindly refer the below code in use.

    [CODE]
    #{txtThenExp}.selectText(startIndex, end);


    Details of the installed Ext.Net:

    Description: Ext.NET Pro
    Runtime Version: v4.0.30319
    Version: 2.5.0.30649
  2. #2
    Hello @SubhamParida!

    Change your code to also focus the text field like this:

    #{txtThenExp}.selectText(startIndex, end);
    #{txtThenExp}.focus();
    The "issue" here seems to be just "modernization" changes to browsers which implies that, if a text field is not focused, it cannot have text selected. If you focus somewhere else in the page, the text in the field won't show text selection effect (even grayed out).

    You can still see text selection grayed out if the text field is focused and you click outside the page (address bar, other windows, etc). This probably is to avoid visual confusion on what's being copied if one hits ctrl+c.

    Now, if you need the visual effect of selection in the text field no matter what (even without the field being focused), I'm afraid that's a feature that will need to be implemented ground-up.

    The field keeps its current text selection saved if you query it via #{txtThenExp}.getTextSelection(), if you need it outside the visual field (for page logic). The value returned by it is updated if the user manually select e.g a portion of text in the field though.

    Hope this helps!
    Fabrício Murta
    Developer & Support Expert
  3. #3

    Thank you!! :SelectText not working in Google Chrome : Request for Solution

    Solution is working after swapping the solution line a bit by adding the focus function above.


    #{txtThenExp}.focus();
    #{txtThenExp}.selectText(startIndex, end);

Similar Threads

  1. [CLOSED] Google Chrome and HTTPS
    By moldaschl in forum 4.x Legacy Premium Help
    Replies: 8
    Last Post: Sep 25, 2018, 4:34 PM
  2. Replies: 0
    Last Post: Jul 05, 2013, 10:49 AM
  3. [solved] google earth plugin and ext/coolite solution
    By ashton.lamont in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: May 04, 2010, 12:51 PM
  4. google chrome help
    By [WP]joju in forum 1.x Help
    Replies: 0
    Last Post: Oct 02, 2009, 4:27 AM
  5. Google Chrome ComboBox Render
    By davidhoyt in forum Bugs
    Replies: 3
    Last Post: Dec 18, 2008, 9:48 PM

Posting Permissions