Home >Web Front-end >JS Tutorial >jquery method to get the source code of the current html page_jquery
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 100db36a723c770d327fc0aef2ce13b1
I hope this article will be helpful to everyone’s jquery programming design.