The example in this article describes how jquery obtains the source code of the current html page. Share it with everyone for your reference. The specific implementation method is as follows:
$("#btnGetCode").click(function(){ var a = '<!DOCTYPE html><html lang="zh-cn">'; var z = "</html>" var by = $(":root").html(); $("#codeView").val(a+by+z); });
The $(":root") selector is the root selector
It always starts with
I hope this article will be helpful to everyone’s jquery programming design.