Click and unclick with jquery -
when click in div class="in" want add span inside div class="in" , add background-color.
when click on element that's outside div class = "in" want remove added span , css.
how it?
what one:
$(".in").click(function(event){ event.stoppropagation(); var span = $("<span>my new span</span>").css('background-color', 'yellow'); $(this).append(span); }); $(".outer").click(function(event){ $(this).find('.in span').remove(); }); have @ example http://jsfiddle.net/va2fp/1/
Comments
Post a Comment