I have the following code:
$(this).children("a:eq(0)").append('<img src="'+ (arrowsvar.down[1])
+'" class="' + (arrowsvar.down[0])
+ '" style="border:0;" />'
);
Now I want to remove last appended element (an image). Please give suggestions.
amazing, thank you very much eugene, that really helped me. I had to remove a table, i used the following code.
You can use the :last-child selector to find the last appended element, then you can remove it:
As an alternative, for those who likes more programmatic ways and syntax:
The code from the original question may generate errors (using "this" with the selector). Try the following approach:
try this. Just added .not(':last-child') which excludes the last element in your collection. So you don't have to remove it.