I'm using Firefox.
I want to make an image inside a contenteditable div get selected by code like when you click the image. Bear in mind that when you click on image inside a contenteditable div the image get some little squares around (eight in total) which you can use to resize the image.
you can test the following jsfiddle (please click the image to see the little squares):
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
});
});
Thank you!