在" contenteditable"中选择一个图像。 DIV

时间:2014-09-16 13:51:17

标签: javascript jquery contenteditable

我正在使用Firefox。

我想在代码中选择一个可信的div中的图像,就像单击图像一样。请记住,当您点击一个可疑的div内的图像时,图像会得到一些小方块(总共八个),您可以使用它来调整图像大小。

你可以测试下面的jsfiddle(请点击图片查看小方块):

http://jsfiddle.net/gxux65v7/

HTML:

<input type="button" id="button_select" value="Select" /><br /><br />
<div contenteditable="true">
    <img id="image_plane" src="http://i2.cdn.turner.com/cnn/dam/assets/130731134001-planes-film-dusty-story-top.jpg" width="300" />
</div>

JAVASCRIPT:

$(function(){
    $("#button_select").click(function(){
        /*
         ¿what code to put here to make the image selected and the
         little squares around the image appears as occur when you
         click on the image?
         */
        // $("#image_plane").select(); // this doesn't work
    });
});

谢谢!

0 个答案:

没有答案
相关问题