Update 10-OCT-2017: This little plugin is consistently on the top of most viewed ones on this site. Let's see why.
There are several outerHTML plugins for jQuery around. But I could not find any that works "in the spirit of jQuery".
Side note: Have you seen this plugin ? It gives you list of events attached. Check it out later.
After reading recently the 2 year old post on stackoverflow.com, from where a lot of people are coming here, I have decided, to behave responsibly, and offer an (slightly) more optimized version.
Slightly better version of "my" outerHTL jQuery plugin.
It is optimized to use outerHTML; if one is found.
Is this an optimization or obfuscation? To actually prove if this is better version performance wise, I should test it.
So, here is my humble contribution. It works from jQ 1.3.2 onwards, AND displays outerHTML of the whole current result set of jQuery, by default.
You will get concatenated outer HTML of all the buttons on the current page. Which I think is what one would expect from jQuery. Although surprisingly so, the jQuery html() method does output the inner HTML of only the first element selected. While text() method does output the inner text of all the elements selected.
Display the outer HTML of the 3-rd button element selected.
This is exactly what I want: to control with a selector what I want to select and then to have a plugin which works on the whole of the resulting selection. Where selection was optionally dynamically narrowed with the use of jQuery.
Thank you, thank you, thank you. I wasted about an hour on this going around in circles and this finally did it.
Hi @Nicolas, glad it worked for you, so well.
Previous PostPrevious What is the most feasible implementation of this architecture ?