Home >Web Front-end >JS Tutorial >JavaScript method to print debugging information (Jquery)

JavaScript method to print debugging information (Jquery)

高洛峰
高洛峰Original
2016-11-26 14:14:331599browse

Use alert to output information every time. The amount of information is small and debugging is inconvenient. There is such a method that can write js code better. Because Jquery is used more, I only wrote the debugging method of Jquery. You can also follow your own preferences. , add time before debugging information

/**

* Print JavaScript debugging information, use absolute positioning, and print one empty line each time

*/

function plInfo(obj){
if($("#show").length==0)
$("body").append ("

debug info
");
$("#show").append(obj+"

");
}

/**

* Print JavaScript debugging information, use absolute positioning, and the information printed each time should not be a blank line, and should be connected with --

*/

function plInfoNoBR(obj){
if($("#show").length==0)
$("body").append("

debug info
");
$("#show").append(obj + "--");
}


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn