I am pretty proficient with coding, but now and then I come across code that seems to do basically the same thing. My main question here is, why would you use .append()
rather then .after()
or vice verses?
I have been looking and cannot seem to find a clear definition of the differences between the two and when to use them and when not to.
What are the benefits of one over the other and also why would i use one rather then the other?? Can someone please explain this to me?
var txt = $('#' + id + ' span:first').html();
$('#' + id + ' a.append').live('click', function (e) {
e.preventDefault();
$('#' + id + ' .innerDiv').append(txt);
});
$('#' + id + ' a.prepend').live('click', function (e) {
e.preventDefault();
$('#' + id + ' .innerDiv').prepend(txt);
});
$('#' + id + ' a.after').live('click', function (e) {
e.preventDefault();
$('#' + id + ' .innerDiv').after(txt);
});
$('#' + id + ' a.before').live('click', function (e) {
e.preventDefault();
$('#' + id + ' .innerDiv').before(txt);
});
append
which (use to?) bugs ie, i useappendTo
that seems alsomore correct semantically especially since there'safter
(chain chain chain) - nb:after
is after not within – Mikimikihisa