Home  >  Article  >  Web Front-end  >  Detailed explanation of the use of jquery plug-in extension

Detailed explanation of the use of jquery plug-in extension

php中世界最好的语言
php中世界最好的语言Original
2018-04-19 16:09:351619browse

This time I will bring you a detailed explanation of the use of jquery plug-in extensions. What are the precautions when using jquery plug-in extensions? The following is a practical case, let’s take a look.

The following DEMO shows the method of extending a myshowHtml for dom

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <script src="jquery.js"></script>
</head>
<body>
<p class="container">
  你好
</p>
<script>
  (function($) {
    $.fn.myshowHtml =function(){
      alert(this.html());
    }
  })(window.jQuery)
$(function(){
  $(".container").myshowHtml();
})
</script>
</body>
</html>

I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to the php Chinese websiteOthers related articles!

Recommended reading:

jQuery operation input box statistics word count

jQuery operation anchor point dynamic displacement

EasyUI combines zTree tree structure to create web pages

The above is the detailed content of Detailed explanation of the use of jquery plug-in extension. 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