-1

I have a form with a button written in a .asp page and when it's clicked, it calls for a js function. I need to figure a way to debug this using developer tools.

<html>
<head>
<title>Test</title>
<script type="text/javascript">
$(document).ready(function() {
       $("#butReport").bind("click", butReport_onClick);
    });

function butReport_onClick() {

var cReportOptions = null;

//some code

};
</script>
</head>

<body>

some code.

</body>
</html>
  • 1
    See: [what-is-console-log](https://stackoverflow.com/questions/4539253/what-is-console-log) – Flakes Jun 19 '19 at 07:27
  • As long as the JavaScript is running client-side your issue has nothing to do with ASP. You can use the console to log and track events as linked above, or there's plenty of JavaScript debugging tools available if you do a quick Google search. – Adam Jun 19 '19 at 14:06
  • During the runtime, though i add console.log() inside the function, Nothing was printed in the console tab. Furthermore, Editing of the page was disabled in the source tab in developer tools. so i did the change in the element tab. – Chinthaka Bandara Jun 20 '19 at 06:12

2 Answers2

1

I don't think this has anything to do with classic ASP.

You are missing the jQuery definition in this code, see here https://www.w3schools.com/jquery/jquery_get_started.asp

I added this

<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
<title>Test</title>
<script type="text/javascript">
$(document).ready(function() {
       $("#butReport").bind("click", butReport_onClick);
    });

function butReport_onClick() {

var cReportOptions = null;

//some code
console.log("Hello");

};
</script>
</head>

<body>

<div id="butReport">some code.</div>

</body>
</html>

When I click it I get this:

console output

I hope this helps

Ralpharama
  • 441
  • 4
  • 20
0

button written in asp with id="butReport". Using javascript:

<button id="butReport"></button>

<script type="text/javascript">
var elem=document.getElementById('butReport').onclick = function(){

    // some code
    // test not using console.log();
    document.getElementById('hasilnya').innerHTML = 'test';

}
</script>

<div id="hasilnya" style="margin-top:1em;"></div>