I have two input buttons on my document which are contained in a main div 'container'.
The code i've used for them is:
<input id="anotherservices" type="button" value="Add Another Service">
<input id="addmultiterms" type="button" value="Go">
Now when i click on the first button, i.e. the button with the value "Add Another Service", i need that both the above buttons fade out, and then an ajax request is performed. Then both the buttons get appended to the main 'container' div again.
And this is recursive which means that when i again click on the first button which has been newly appended, again both the newly appended buttons should fade out and another set has to be apppended to the document.
The code ive used for accomplishing this is follows:
$('#anotherservices').live("click",function(e)
{
$(this).fadeOut();
$('#addmultiterms').fadeOut();
/* ajax request goes here */
$('#container').append('<input id="anotherservices" type="button" value="Add Another Service">');
$('#container').append('<input id="addmultiterms" type="button" value="Go">');
But the second button, with the value "Go" isnt fading out because it is not being added to the dom at runtime.
How do i accomplish this?