Remove tr - jQuery
<p>I am trying to remove a TR in a table view. when I hit delete.</p>

<p>However I am having issue doing this.</p>

<pre><code>$("#deletelead").live('click', function(event){
    deleteid = $("tbody td.small input:checkbox:checked").map(function(i, el) { return $(el).attr("id"); }).get();
    $("tr").remove().before("input:checkbox:checked").map(function(i, el) { return $(el).attr("id"); }).get();
    //alert(deleteid.length);   

    $.each(deleteid, function(index, value) { 




    $.ajax({
                type: "POST",
                url: "system/classes/core.php",
                data: "task=deletelead&amp;customerid="+deleteid,
                success: function(data){
                    if((data) == 1)
                    {
                        //loadadminlayout();
                    }
                    else
                    {
                    alert(data);    
                    }
                }
            });
    return false;

    });
});
</code></pre>

<p>jQuery code that creates the table</p>

<pre><code>function listallleads(){


    var script = document.createElement('link');
    script.href = 'theme/style/manageleads.css';
    script.rel  = 'stylesheet';
    script.type = 'text/css';
    document.getElementsByTagName('head')[0].appendChild(script);

    if ($.browser.msie &amp;&amp; $.browser.version == 8) {
        var script = document.createElement('link');
        script.href = 'theme/style/ie-manageleads.css';
        script.rel  = 'stylesheet';
        script.type = 'text/css';
        document.getElementsByTagName('head')[0].appendChild(script);
    }



    $.getJSON(URLLINK, function(dataleads) {

      $.each(dataleads,function(i, myleads){
        var businessname = "";
        if(myleads.Company == null || myleads.Company == "null" || myleads.Company == "")
        {
        businessname = myleads.TradingName; 
        }
        else
        {
        businessname = myleads.Company;
        }

        if(usertype == 3)
        {
            if(myleads.AMStatus == 1)
            {
            leadstatus = "All Confirmed";   
            }
            else 
            {
            leadstatus = "Not Confirmed";   
            }

        }
        else 
        {
            leadstatus = leadstatusselect(myleads.LeadStatus);
        }

        if(myleads.AMStatus == 1)
        {
            myleads.AMStatus = "one";
        }



        cssstats = "lead"+myleads.AMStatus



            $("tbody").append('&lt;tr id="'+myleads.customer_id+' class="'+cssstats+'"&gt;'+
'           &lt;td id="row" class="small"&gt;&lt;input id="'+myleads.customer_id+'" type="checkbox"&gt;&lt;/td&gt;'+
'           &lt;td&gt;'+myleads.CreatedTime+'&lt;/td&gt;'+
'           &lt;td&gt;'+businessname+'&lt;/td&gt;'+
'           &lt;td class="center"&gt;'+myleads.FirstName+' '+myleads.LastName+'&lt;/td&gt;'+
'           &lt;td class="center"&gt;'+myleads.Phone+'&lt;/td&gt;'+
'           &lt;td class="center bigger"&gt;'+myleads.Email+'&lt;/td&gt;'+
'           &lt;td class="center"&gt;'+myleads.stafffirstname+' '+myleads.stafflastname+'&lt;/td&gt;'+
'           &lt;td class="center last"&gt;'+leadstatus+'&lt;/td&gt;'+
'       &lt;/tr&gt;');
      });
        qs.cache();
    });

    if(usertype == 3)
    {
    leadtype = "A/M Status";    
    }
    else
    {
    leadtype = "Lead Status";   
    }

    $("#todo_bg").hide();
    $("#menuarea").html('&lt;a id="gotohome"&gt;&lt;div id="backmain" class="backbg"&gt;Back&lt;/div&gt;&lt;/a&gt;&lt;div id="nav" class="backbgright"&gt;Manage Business Lead&lt;/div&gt;'+
                        '&lt;div id="dowithleads"&gt;&lt;button id="editlisting" class="blackbutton manage"&gt;Edit Listing&lt;/button&gt;&lt;button id="sendemailout" class="blackbutton manage"&gt;Send Message&lt;/button&gt; &lt;button id="deletelead" class="blackbutton manage"&gt;Delete Lead&lt;/button&gt;'+
                        '&lt;div id="searchbox"&gt;&lt;form action="#"&gt;&lt;fieldset&gt;&lt;input type="text" name="search" value="" id="searchleads" placeholder="Search" autofocus /&gt;&lt;/fieldset&gt;&lt;/form&gt;&lt;/div&gt;'+
                        '&lt;/div&gt;'+
                        '&lt;div id="dowithleads"&gt;&lt;table cellpadding="0" cellspacing="0" border="0" class="sortable paginated scrollTable" id="manageleads"&gt;'+
'   &lt;thead class="fixedHeader"&gt;'+
'       &lt;tr&gt;'+
'           &lt;th class="small" id="first"&gt;&lt;input type="checkbox" class="checkbox checkall" value="Yes"&gt;&lt;/th&gt;'+
'           &lt;th class="sort-alpha"&gt;Created Time&lt;/th&gt;'+
'           &lt;th class="sort-alpha"&gt;Company&lt;/th&gt;'+
'           &lt;th class="sort-alpha"&gt;Lead Name&lt;/th&gt;'+
'           &lt;th class="sort-alpha"&gt;Phone No.&lt;/th&gt;'+
'           &lt;th class="sort-alpha bigger"&gt;Email&lt;/th&gt;'+
'           &lt;th class="sort-alpha"&gt;Lead Owner&lt;/th&gt;'+
'           &lt;th class="sort-alpha last"&gt;'+leadtype+'&lt;/th&gt;'+
'       &lt;/tr&gt;'+
'   &lt;/thead&gt;'+
'   &lt;tbody class="scrollContent"&gt;&lt;/tbody&gt;'+
'&lt;/table&gt;&lt;/div&gt;');  


    setTimeout(function(){
    var script = document.createElement('script');
    script.src = 'js/table.js';
    script.type = 'text/javascript';
    document.getElementsByTagName('head')[0].appendChild(script); 
    stripedTable();
    },2000);


    var qs = $('input#searchleads').quicksearch('table#manageleads tbody tr');
}
</code></pre>
