Is there a way to get line number of a certain tag using JavaScript?
For example, if I have the following HTML file:
<!doctype html>
<html>
<head>
<title>test</title>
</head>
<body>
<script>
x = "<script>"
</script>
<script>
</script>
</body>
</html>
then:
- head tag is on line 3
- title tag is on line 4
- body tag is on line 5
- script tag is on line 7 and 10
Perhaps something like document.getElementsByTagName('script')[0].lineNumber
?