I have this html tags that I criated with a click event.
After this via jquery I am adding to it dynamically another tag (span).
I want that the span will not execute the alert, how?
(if I click on the “I am new Text” – I want nothing to happened )
you can test it here: http://jsfiddle.net/r97AT/16/
what I did here not working:
<b onclick="alert('q1')" id="q1" class="test">test</b>
<br>
<b onclick="alert('q2')" id="q2" class="test">test</b>
<br>
<b onclick="alert('q3')" id="q3" class="test">test</b>
$(document).ready(function () {
$(".test").each(function () {
$(this).append(function () {
return $('<span id="newChild_'+$(this).attr('id')+'" style="color:red"> I am new Text</div>');
});
$('#newChild_' + $(this).attr('id')).live('click', function (e) {
e.stopPropagation();
});
});
});
Try this: