Home  >  Article  >  Web Front-end  >  What is the comment statement of jquery

What is the comment statement of jquery

青灯夜游
青灯夜游Original
2022-06-15 11:25:551761browse

There are two types of jquery comment statements: 1. Single-line comment statements, the syntax is "//comment content"; all content after "//" will be regarded as the content of the comment and will not be parsed, but will be Content before "//" will not be affected. 2. Multi-line comment statements, the syntax is "/* comment content */"; any characters contained between "/*" and "*/" will be regarded as comment text and will be ignored by the browser.

What is the comment statement of jquery

The operating environment of this tutorial: windows7 system, jquery3.6.0 version, Dell G3 computer.

There are two types of jquery comment statements:

  • Single-line comment statements

  • Multi-line comments Statement

1. Single-line comment statement

Single-line comment: Use "//" to make a single-line comment;" All content after "//" will be regarded as comment content, and the content before "//" will not be affected.

//这是一行注释,只能注释单行。
$(document).ready(function() {
	$("button").click(function() {
		// $("textarea").prop("readonly",true);
	});
});

Use single-line comments At this time, any characters or codes in the same line after // will be ignored and will not be parsed.

2. Multi-line comment statements

Multi-line comments: Use "/* */" to make multi-line comments; appear in " All content between "/*" and "*/" will be regarded as the content of the comment.

Multi-line comments, usually at the beginning of the file, introduce author, function and other information.

/*
  给按钮元素绑定点击事件
  点击按钮,让文本框只读
 */
$(document).ready(function() {
	/*$("button").click(function() {
		$("textarea").prop("readonly",true);
	});*/
});

In multi-line comments, any characters contained between the /* and */ symbols will be regarded as comment text and will be ignored by the browser.

[Recommended learning: jQuery video tutorial, web front-end development]

The above is the detailed content of What is the comment statement of jquery. For more information, please follow other related articles on the PHP Chinese website!

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