Why isn't this snippet showing "YES" in the div id = debug
after
- each item in
id=box
is clicked and placed inid=que
. (assigned classclick2Remove
) - then clicked again in que?
?
<script>
var idcurrent = 0;
$(document).ready(function() {
$(".click2Select").click(function() {
idcurrent = this.id;
$("#" + idcurrent).attr("class", "removed");
var s = '<a href="" onclick="return false" id="' + idcurrent + '" class="click2Remove">' + $("#" + idcurrent).html() + '</a>';
$("#que").append(s);
$("#debug").html("selected and in que: "+idcurrent);
});
});
$("#que").delegate("click2Remove", "click", function() {
$("#debug").html("YES");
});
</script>
<div id="box">
<li><a class="click2Select" onclick="return false" href="#" id="1">1</a></li>
<li><a class="click2Select" onclick="return false" href="#" id="2">2</a></li>
<li><a class="click2Select" onclick="return false" href="#" id="3">3</a></li>
</div>
<div id="que">
</div>
<div id="debug">
</div>