[RESOLVED]show hide border of image

i have a web page that drags element from div and drop them to another div.

for the elements on the drop div. when click i add a border to it, using this code.

 $(this).css(‘border’, "dotted 1px black");

i need that when i click outside the element in the drop area (drop div) to remove the border.

Hi,

you may add this script

<script>
$("#drop").click(function (e) {
    $(this).css('border', "dotted 1px black");
});

$(document).mouseup(function(event){
    var target = $("#drop");
    if(!target.is(event.target) && target.is(":visible")){
       $("#drop").css('border', "none");
    }else{
      return false;
    }
});
</script>

here is a example for you

Leave a Reply