javascript - Borrow jQuery's show and hide -


$('.foo').each(function () {     var $this = $(this);     var footext = $this.text();     var displayfunction = (footext.tolowercase().indexof(filtertext.tolowercase()) != -1) ? $.show : $.hide;     displayfunction.apply($this);     displayfunction.apply($this.next()); } 

looks $.show , $.hide undefined, how can resolve this?

use $.fn.show , $.fn.hide.

all instances of $ inherit methods defined on $.fn, alias prototype of jquery. alternatively use $().hide there's no need create instance.


Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Magento/PHP - Get phones on all members in a customer group -

session - Logging Out Using PHP -