Selecting the image after execCommand

Posted by jerebear on Stack Overflow See other posts from Stack Overflow or by jerebear
Published on 2011-01-07T18:26:47Z Indexed on 2011/01/07 22:54 UTC
Read the original article Hit count: 104

Filed under:

Have been banging my head against the wall on this one for a while now.

I have an editor that is inserting an image but I can't get it to select the newly inserted image in Firefox after execCommand Runs. Here's my code.

        var editor = this;
        var sel = editor._getSelection();
        var range = editor._createRange(sel);           
        editor._doc.execCommand("insertimage", false, imgURL);
        img = range.startContainer.previousSibling;
        console.log(img);

© Stack Overflow or respective owner

Related posts about JavaScript