Say I have two buttons “Add Link” and “Add Text”. The “Add Link” button automatically appends the following to the existing page:
<a href="text.html"></a>
When i click on the button “Add Text”, the text of all dynamic links created should contain the text “Text”.
I originally use “$(“a”).text(“Text”)” for the function of the “Add Text” button, but it does not work because the links are dynamically created as the user clicks the “Add Link” button.
How do I make it so that I can get “Text” into all of the dynamically created link?
NOTE: Something Like this
$('buttonforaddtext').live('click', function() {
$("a").text("Text");
});
Does not work for me because the button has been there the whole time, its the “a” that are dynamically created with the click of the “Add Link” button.
Try like below as I mentioned in comment,