官术网_书友最值得收藏!

  • JavaScript by Example
  • Dani Akash S
  • 378字
  • 2021-07-02 18:39:06

Chrome DevTools

In the body section, we have an input field with a button to add a new task and an unordered list to list out the tasks. The unordered list will have a checkbox to mark the task as completed and a delete icon to remove the task from the list. You might notice that the first item in the list is marked completed using a strike-through line. If you inspect the element using Chrome DevTools, you will notice that it has an additional class complete, which adds a strike-through line on the text using CSS, which is defined in our styles.css file.

To inspect an element using Chrome DevTools, right-click over that element and select inspect. You can also click Ctrl+Shift+C on Windows or Linux, or command+shift+C on Mac, and then, hover the cursor over the element to see its details. You can also directly edit the element's HTML or CSS to see the changes reflected on the page. Delete the complete class from the div of the first item in the list. You'll see that the strike-through line has gone. The changes made directly in the DevTools are temporary and will be cleaned when the page is refreshed. Take a look at the following image for a list of tools available to inspect an element in Chrome:

  • A: Inspect element from right-click
  • B: Click the cursor icon and select a different element by hovering the cursor over the element
  • C: Directly edit the HTML of the page
  • D: Directly edit the CSS associated with an element

One other nice feature of Chrome DevTools is that you can write debugger anywhere in your JavaScript code and Google Chrome will pause the execution of the script at the point in which debugger was called. Once the execution is paused, you can hover your cursor over the source code in sources tab and it will show the value contained in the variable in a popup. You can also type in the variable's name in the console tab to see its value.

This is the screenshot of Google Chrome debugger in action:

Feel free to explore the different sections of the Chrome Developer Tools to understand more about the tools it provides for the developers.

主站蜘蛛池模板: 佛坪县| 吉隆县| 克东县| 库车县| 鱼台县| 固原市| 连平县| 台江县| 股票| 济阳县| 剑河县| 西和县| 天镇县| 盘锦市| 福清市| 卢氏县| 正蓝旗| 肇东市| 抚顺县| 武清区| 航空| 中西区| 西充县| 余庆县| 元阳县| 五华县| 巴彦县| 留坝县| 鹤庆县| 永安市| 崇文区| 尤溪县| 广河县| 鹤壁市| 衢州市| 赤壁市| 广灵县| 新乡市| 乌鲁木齐市| 竹溪县| 武山县|