Preface
In the previous section, we implemented a style table with CSS, and added a full selection feature, this section uses jquery to implement the deletion of the specified line function. The following effect diagram:
This chapter sample code point this download
Implementation Code
table3.html Content
<! DOCTYPE html>
Comparing the table2.html content of the previous section, only a few lines of code were added, the following changes were made for <a></a>
<a title= "Delete" onclick= "Article_del (This)" href= "javascript:;" > Delete </a>
Where the onclick is obviously the function executed for the <a> click event.
Where href= "javascript:;" Maybe some beginners don't understand. The href attribute of the <a> tag specifies that the value of the Url,href property of the hyperlink target can be a relative or absolute URL for any valid document, including fragment identifiers and JavaScript code snippets. Here's href= "javascript:;", where JavaScript: is a pseudo-protocol that allows us to invoke JavaScript functions through a link, and in this way javascript: can implement a-tag click event Runtime, If the page content is many, there are scrollbars, the page will not jump, the user experience is better. Perhaps you will think, with href= "#", I can only say, try ~
Conclusion
Next section write dynamic add row