0

I'm using the inline NicEdit editors and I want the entire text of the inline editor to be selected on a focus event for easy deletion, since it contains a placeholder text which should be deleted at all times. It is important for the user experience that the placeholder text is selected/highlighted and not just deleted instantly on focus.

Since this is not a <textarea> the jQuery .select() method cannot be used for this purpose but maybe there is a workaround?

I appreciate your help.

  • This is not a duplicate of the link suggested since this question is not about a ` – Emil Østergård Johansen Apr 19 '17 at 09:15

1 Answers1

0

I just grabbed the id and used .empty()

 myNicEditor.addEvent('focus', function(e) {
      var id = myNicEditor.selectedInstance.e.id;
      $("#"+id).empty();
  });

Here is a fiddle

Kelly J Andrews
  • 5,083
  • 1
  • 19
  • 32