jQuery set a radio input

I finally found the answer here:

Basically, if you want to check one radio button, you MUST pass the value as an array:


So no more of these pre/post v1.6 versions:

$("#radio_1").prop("checked", true);
$("#radio_1").attr('checked', 'checked');
$("input[name=background][value='some value']").prop("checked",true);
$("#radio_1").prop("checked", true).change();
// JQueryUI
$("#option2").prop("checked", true); // Check id option2
$("input[name='radio_options']").button("refresh"); // Refresh button set

Have a nice day!

Loading speed vs code readability

ctrl-ZVXAs a developer I like structured code. The browser however could not care less about the right amount of tabs and spacing; it just need to get the code, with as little data-traffic as possible.

So, what do I do? When speed is really important, I create my stylesheets and javascripts as I normally do, but then also convert these into a “.min’ version – minified, and refer to those from the html source code.

To get this done Continue reading Loading speed vs code readability