- Forums
- Javascipt
- How To Get Line Number Code In Javascript Script File
if you need to get the line number from a particular location in your javascript script within the code i will show you how to get the line number [8719], Last Updated: Sat May 18, 2024
jquery_audit
Wed Dec 31, 1969
0 Comments
186 Visits
today i was writing a javascript code and i was debugging because i could not know where the error was coming from. i was using jquery and i got this error on my firefox firebug that says:
TypeError: o is undefined
ok, so what am i doing wrong.. i dont know so need to know on what line of the function i was calling to the problem was. the best way was to know where the line number of the code was where it broke the script.
so, its very easy, just put this code in your javascript
alert('LINE '+Error().lineNumber);
simple, it will show you an alert with the line number
hope that helps