@prantor19 just twittered a list of useful jQuery Snippets for 2014:
Rocking and Useful jQuery Code Snippets For 2014 http://t.co/B3fIWpM1nO
— Arif (@prantor19) 3. März 2014
Well, I’m not to sure about some of these snippets. Sometimes, I think, you should CSS like for example:
I just don’t get it, why you cant just use CSS
There are some others too, which would fit more into a title “Did you know, jQuery is able to…?“.
$('input [type="submit"]').attr('disabled', true);
Yes! With jQuery you can alter attributes!
Well really, what is so rocking about
var anchor = $('#anchor');
So, despite the strange title, which really hasn’t proven for me, I do like this one:
console.log('images successfully loaded');
Its quite obvious, when you see it, but I haven’t thought about this possibility yet. Why should the load-function just work with window?? I will try this one for sure!
And this one here
is quite nice to investigate further. As the jQuery Docs explain “Insert content, specified by the parameter, after each element in the set of matched elements”. So this piece of code puts a break between all <,p>-Tags, but not behing the last one, because
:not(:last-of-type) I like this usage of the selectors and once again it shows the power of them.
Thanks for the Tweet!
Latest posts by David Remer (see all)
- BuddyPress Desktop Notification 0.7 Release - January 14, 2016
- The problem of slug identification in the repository - August 11, 2015
- WordPress Support Ticket - August 10, 2015