jQuery: How to set one <select> element to the value of another (using onchange equivalent)
Say you have an HTML <select> form element and you want to set another <select> element equal to the first one when it changes. Here's an easy way to do so with jQuery:
$('#id_of_select1').change(function() {
var select1_value = $(this).val();
$('#id_of_select2').val(select1_value);
});
----------------
Now playing: Drexciya - Astronomical Guidepost
via FoxyTunes
jQuery: How to get the ID of an element.
Say you want to know the ID of an element using jQuery. You can achieve this easily using jQuery's attr() method:
var currentId = $('#element').attr('id');
But this is fairly useless, because it requires you to already know the ID of the element that you want. Usually you'll want to find out the ID if you don't already know it -- given a jQuery 'this' object:
var currentId = $(this).attr('id');
This will only work provided that you have a valid jQuery object $(this) that you are working with, eg:
$(document).ready(function() {
$('input.text').focus(function() {
$('input.text').removeClass('onFocus'); /* remove focus state from all input elements */
$(this).addClass('onFocus'); /* add focus state to currently clicked element */
var currentId = $(this).attr('id');
});
};
Using the code above, you will now know the ID of the currently focused input element. This can come in handy later on if you want to perform further actions on the element.
----------------
Now playing: Amon Tobin - Precursor (feat. Quadraceptor)
via FoxyTunes
Thunderbird HowTo: Show email count in folder pane.
If you'd like to see a count of how many emails are contained in each folder in Thunderbird, here's how:
- Tools > Options > Advanced > General
- Check "Show expanded columns in the folder pane"
- Click OK to accept changes.
- At the top of the folder pane, click the column selection icon (
) and select the columns that you would like to see. You can choose to display Total, Unread, and/or Size.
----------------
Now playing: Physics - First 7" - Side 2
via FoxyTunes
Crusty Old White Dude Ratio: Democrats vs. Republicans
Using the pictures below, I've calculated the crusty-old-white-dude ratio for both the Democrats and Republicans in the 2008 Presidential Campaign debates:
Democratic crusty-old-white-dudes: 5/8 = 62.5%
Republican crusty-old-white-dudes: 10/10 = 100%
Click photos for bigger versions:
|
Democrats: |
Republicans: |
|---|
Squarepusher Q&A

Came across this pretty fuckin-a-awesome Q&A session with Squarepusher on the BBC site. At some points he comes across as a rambling human thesaurus, at others an enlightened philosophy Ph.D., and still others the manical musical genius we've grown to love. I'd love to sit next to this dude in a pub and chit-chat for hours over some cold ones. Choice quote:
I'm interested to further my knowledge in [the cocktail] department, but as I live in a tiny Essex village with one pub that struggles to serve a decent pint of beer, my day-to-day chances of achieving this seem slim.
iPod stuck with Apple logo on screen
My 3G iPod got stuck with the Apple logo on its screen. The way to fix this is to put the iPod into Disk Mode and restore it from there. Here is how:
- Reset the iPod by holding down the Menu and Play buttons simultaneously.
- As soon as it reboots, hold down the Fast Forward and Rewind buttons simultaneously.
- Your iPod will now be in "Disk Mode" and you should be able to plug it into your computer, open up iTunes, and restore your iPod.
iPod does not appear in iTunes.
I have an old 3G iPod, and all of a sudden it would not show up in iTunes when connected to my computer via Firewire or USB. It did show up in Finder. After some research, the only way I found to fix this is to format it using Apple's Disk Utility. WARNING: Doing this will wipe everything off your iPod. You won't be able to recover the files off your iPod, but at least you'll be able to use it with iTunes again.
- Connect your iPod you to your Mac.
- Open up Disk Utility (Finder > Applications > Utilities > Disk Utility).
- Select your iPod in the left-hand window pane.
- Click the "Erase" tab, accept all defaults, then click the "Erase" button.
Your iPod will now be re-formatted, and you should be able to plug it into iTunes and Restore the updated iPod software.
UPDATE: For PCs, you may be able to do something similar with Windows' Disk Manager. I haven't tried though, so I can't verify, but I bet it would work on Windows too.