Question: Please HELP with JQUERY and JavaScript 1.In the jquery.altrow.js file, code a plugin that uses the getElementsByTagName method to get all of an elements tr
Please HELP with JQUERY and JavaScript
1.In the jquery.altrow.js file, code a plugin that uses the getElementsByTagName method to get all of an elements tr child elements. Then, it should apply a class named header to the header row, and classes named even and odd on an alternating basis to the rest of the rows. Note: you can check whether a row contains th elements to see if its a header row.
2. In the altrow.js file, add code to the onload event that calls the plugin for the table element. Run the application and see that the row styles are applied to the table.
HTML file:
Important People in Computer Science
| First Name | Last Name | Date of Birth | Accomplishment |
|---|---|---|---|
| Charles | Babbage | 12/26/1791 | Originated the concept of a programmable computer, invented the first mechanical computer. |
| Ada | Lovelace | 12/10/1815 | First computer programmer. Wrote an algorithm for Babbage's mechanical computer. |
| Alan | Turing | 6/23/1912 | Invented the Turing Machine, a hypothetical device that's a model of a general purpose computer. |
| Grace | Hopper | 12/9/1906 | Invented the first compiler for a computer programming language, popularized the term "debugging" for fixing computer glitches. |
query.altrow.js file:
"use strict";
(function ($) { $.fn.pluginName = function(){ return this.each(function() { //the code for the plugin }); }; }) (jQuery);
altrow.js file
"use strict";
window.onload = function() { };
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
