return a value as a closure, get the innerhtml instead of $(.x).html
First off the click event is not firing.
Presumably because I am using the class .x instead of the innerhtml which is also x.
What I want is the event to fire when the x is clicked.
The "x" is in a span enclosed by table row, table definition:
i<tr><td><span class="x">x</span></td></tr>
function delete_handler(e){
var $target =$(event.target);
if( $target.is(".x")){
var id = row.attr("id");
$("#mytable").find("tr:eq(input:checked)").remove();
};
return id;
}
$(".x").click(delete_handler);
The second thing I would like is to return the id as a closure so that I can use it to call an AJAX function to delete that row on the backend. So as I understand closure you need to return a function. It seems to me this might be a good use of closure to keep the value alive for the AJAX function to delete from the database.