Selection of text in inline editor

Selection of text in inline editor

GeorgeHelmkeGeorgeHelmke Posts: 44Questions: 16Answers: 0

When the user enters the inline editor, the cursor is placed in front of or behind the existing text entry. Is there a way to auto-select that current text?
The reason is that for a quantity field, it starts with 0. It is too easy for the user to end up with 1000 when they meant 100.

Thanks!

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin
    Answer ✓

    For an individual field use:

    $( 'input', editor.field('myField').node() ).on( 'focus', function () {
      this.select();
    } );
    

    For all fields:

    $( 'input', editor.node() ).on( 'focus', function () {
      this.select();
    } );
    

    Allan

This discussion has been closed.