I have a form that adds a product to a pricelist. The submit button on the form value is ADD. It adds it using AJAX. But I want it to change the ADD to REMOVE and be able to click remove and turn that back into add.
The code I use for this looks like this:
<script type=\"text/javascript\">
$(document).ready(function() {
$('#form').submit(function() { // catch the form's submit event
$.ajax({ // create an AJAX call..
type: $(this).attr('method'), // GET or POST
url: $(this).attr('action'), // the file to call
success: function(response) { // on success..
$('#td_form').html(response); // update the DIV
...
the submit button is in a: <td id="td_form"><input type="submit" name="act" value="add"></td>
The response from when the form submits is: <input type="submit" name="act" value="remove">
it adds the item to the list and it changes the submit button to remove but clicking on remove does not work as I think it should. Is it because the DOM changed? Any help wopuld be appreciated and sorry for such a lame question.