Getting started with jQuery plug in extension operation example

  • 2021-07-12 04:42:10
  • OfStack

This article illustrates the jQuery plug-in extension operation. Share it for your reference, as follows:

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


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

More readers interested in jQuery can check the topics of this site: "Summary of jQuery Extension Skills", "Summary of jQuery Common Plug-ins and Usage", "Summary of jQuery Switching Effects and Skills", "Summary of jQuery Traversal Algorithms and Skills", "Summary of jQuery Common Classic Effects", "Summary of jQuery Animation and Special Effects Usage" and "Summary of jquery Selector Usage"

I hope this article is helpful to everyone's jQuery programming.


Related articles: