I have a screen with several divs that are draggable.
However, when the user clicks on them, I need to create a border around them and add some options (delete, for example).
But when I clicked off this element, I want it to come out of that border, and also to drop the options.
I'm trying the following way, but instead of grabbing what was clicked, it takes the document:
$(document).click(function() {
var objeto = $(this);
if( objeto.prop('class') == "adesivo" || objeto.prop('class') == "quadro")
{
selecionaElemento(objeto);
}
else
{
deselecionaElementos();
}});
The selecionaElemento(objeto)
function does the following:
function selecionaElemento(objeto){
objeto.css("border", "1px solid #F00");
}
And the deselectsElements () does the following:
function deselecionaElementos(){
$('.adesivo').css("border", "none");
$('.quadro').css("border", "none");
}
What am I doing wrong that instead of picking up the element it gets the document?