hi guys need little bit help..
i know .live
is no more working in jQuery v1.9 is there any alternative that my below function get back working i try .on()
and .bind()
but did not succeed.
here is fiddle
HTML
<div id="container">
<p>There are 0 boxes</p>
<a href="#" class="more">Add more +</a>
</div>
jQuery
$(".more").click(function() {
$("#container").append("<div class='box'><a href='#'>x</a></div>");
var count = $(".box").length;
$("p").text("There are " + count + " boxes.");
if(count>2){
$(".more").hide();
}
});
$(".box a").live("click", function() {
$(this).parent().remove();
var count = $(".box").length;
$("p").text("There are " + count + " boxes.");
if(count<3)
{$(".more").show();}
});