Use jQuery to delete HTML table rows by clicking it-Ultra simple, jquery table
JQuery has become one of the most common and favorite JavaScript frameworks at all times. It not only reduces the technical overhead of simple JavaScript encoding, but also makes your code cross-browser compatible. I have already written many jQuery tutorials. At this time, I also use this simple pure implementation. The task is to use some trendy effects from an HTML table, as long as you click the row of the row. The following is the jQuery code to achieve this goal.
$(document).ready(function() { $("#sample tr").click(function() { //change the background color to red before removing $(this).css("background-color","#FF3700"); $(this).fadeOut(400, function(){ $(this).remove(); }); }); });
In the above Code, we have attached all the "TR" handlers in the "# example" table. Next, we first change the background of the row, then fade out and delete it. This is a simple task.
How can I create a table when I click the html button?
With jquery, this is simple. You can try Baidu again. The following is a reference:
$ ("# Button"). click (function (){
$ ("Table"). append ("<tr> <td> </tr> ");
}
Daxia helps write a Jquery code to delete table rows.
<Html xmlns = "www.w3.org/5o/xhtml">
<Head>
<Title> </title>
<Script type = "text/javascript" src = "js/jquery-1.2.3-intellisense.js"> </script>
<Script type = "text/javascript">
Function shanchu (){
$ (This). parent (). parent (). remove ();
}
$ (Function (){
$ ("A"). click (shanchu );
})
</Script>
</Head>
<Body>
<Table>
<Tr>
<Td> xxxx </td> <a href = "#"> Delete </a> </td>
</Tr>
</Table>
</Body>
</Html>