D
D
Dev123452020-05-03 15:25:06
JavaScript
Dev12345, 2020-05-03 15:25:06

How to connect the script to the console?

Why are scripts not being executed in the browser console. I call a function in the console from a script that is connected and does not work, what should I do?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Valentyn, 2020-05-03
@Dev12345

When using a structure like this:

$(document).ready(function(){
   function sameFunc() {
       // code
   }
}):

The function must be declared outside the ready body, something like:
var sameFunc = null;
$(document).ready(function(){
   sameFunc = function() {
       // code
   }
}):

With this option, calling it from the developer tools console should be processed.
The answer is based on guesswork, providing a code snippet would be more accurate.

A
Alexander, 2020-05-03
@NeiroNx

This means that the functions are out of scope of the console.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question