How to use radio on change event?

You can use this which refers to the current input element. http://jsfiddle.net/4gZAT/ Note that you are comparing the value against allot in both if statements and :radio selector is deprecated. In case that you are not using jQuery, you can use the document.querySelectorAll and HTMLElement.addEventListener methods:

Easiest way to toggle 2 classes in jQuery

If your element exposes class A from the start, you can write: This will remove class A and add class B. If you do that again, it will remove class B and reinstate class A. If you want to match the elements that expose either class, you can use a multiple class selector and write:

angular.element vs document.getElementById or jQuery selector with spin (busy) control

I’m using the “Angularised” version of the Spin control, as documented here: http://blog.xvitcoder.com/adding-a-weel-progress-indicator-to-your-angularjs-application/ One of the things I don’t like about the shown solution is the use of jQuery in the service that effectively attaches the spin control to the DOM element. I would prefer to use angular constructs to access the element. I’d also … Read more

Why define an anonymous function and pass it jQuery as the argument?

The two blocks of code you have shown are dramatically different in when and why they execute. They are not exclusive of each other. They do not serve the same purpose. JavaScript Modules This is a “JavaScript Module” pattern, implemented with an immediately invoking function. http://addyosmani.com/resources/essentialjsdesignpatterns/book/#modulepatternjavascript http://www.adequatelygood.com/2010/3/JavaScript-Module-Pattern-In-Depth The purpose of this code is to provide … Read more