[jQuery] re[jQuery] -bind, only on first "add"
Hi
I have some problem to re-bind after adding data to a page using append and
a click-function, never used that before!
If I add one "textTag" that one can use the "removeTag" but if I add more
then one "textTag" I get alla the alerts "test" on the first add and the
rest gest none??
Some advise please/ Johannes
// globals
var i = 0;
var tagArr = [];
var theTag = '';
// ad new tag
$('#addTag').click(function() {
// grab the tag
var textTag = $("#textTag").val();
if(textTag != ''){
// appand to page
$('#theTags').append(textTag + ' \"/text/removetag/tagid/' x ');
// remove tag, inside to re-bind new elements
$("a#removeTag").click(function(){
alert('test');
return false;
});
// clear gui
$('#textTag').val('');
// increase key
i++;
}
$("#textTag").focus();
return false;
});
--
View this message in context: http://www.nabble.com/re-bind%2C-only-on-first-%22add%22-tp19706233s27240p19706233.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.