From the course: jQuery: Creating Plugins

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Using selectors and chaining to make the plugin work properly

Using selectors and chaining to make the plugin work properly - jQuery Tutorial

From the course: jQuery: Creating Plugins

Start my 1-month free trial

Using selectors and chaining to make the plugin work properly

- Here we are in a state where the first three boxes have not had their height equalized and the second group of three boxes always has its height equalized. Now, it's possible that on your screen, the boxes won't be perfectly equal in height. That's fine. I wanted to keep the code simple, and on a responsive page like this, there might be a couple edge cases where it doesn't work. For our purposes, it just needs to be close enough that you can see an effect when the page first loads. Now, of course, here we just didn't get the effect where the plugin was invoked. So we need to fix this. Referring back to this code, I can see that what I'm definitely gonna need to do is change this bit, so that the plugin can act on anything. This is almost startlingly easy. In any jQuery plugin, right inside this function, the object or collection of objects upon which you wanna act is referred to by the this keyword, just like that. If I do nothing but save this and switch back to my browser and…

Contents