Skip to main content

Bug Tracker

Side navigation

#13386 closed bug (worksforme)

Opened February 05, 2013 06:00AM UTC

Closed February 05, 2013 02:19PM UTC

focus() on contenteditable DIV with height & width of 0

Reported by: anonymous Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: git
Keywords: Cc:
Blocked by: Blocking:
Description

For a DIV of size 0 with contenteditable true, jQuery focus() method doesn't seem to work. When I replace it with .get(0).focus(), the native JS method, it works.

Attachments (0)
Change History (2)

Changed February 05, 2013 06:04AM UTC by anonymous comment:1

Here's the exact code:

var pasteCatcher = $(document.createElement("div"));

pasteCatcher.attr("contenteditable","true").css({width : "0", height : "0", overflow : "hidden", outline : 0});

$("body").prepend(pasteCatcher);

$(document).bind("paste", function() {

pasteCatcher.focus(); // does not work but .get(0).focus() works

});

Changed February 05, 2013 02:19PM UTC by dmethvin comment:2

resolution: → worksforme
status: newclosed