How to limit a jQuery plugin function to only some elements?

后端 未结 2 1965
情书的邮戳
情书的邮戳 2021-01-22 20:42

I check the jQuery plugin site, which teach me how to write a basic plugin:

(function( $ ){
  $.fn.maxHeight = function() {
    var max = 0;
    this.each(functi         


        
2条回答
  •  悲哀的现实
    2021-01-22 21:28

    You could do...

    this.filter('textarea')
    

    If you do an each() on the returned set, it will only iterate over selected textarea elements.

提交回复
热议问题