Keypress vs keydown in jquery

In todays web world, forms and input bars are very important. We all use searching and filtering in our applications. The easiest and obvious way to do this while using JS(jquery) is binding key events to the search bar.

The event I usually bound was ‘keypress’. This is fine and works good. But the actual meaning of keypress , in its original form in IE world (!!!!!) is the event which actually adds some value in the input field. Some keys like backspace, delete, clt etc do not add any value and hence are not detected by keypress event.

These are important keys as often in filtering when the input field is empty, we might want to show all results. The user might type some query and delete it and hence detection of such keys is important.

To avoid such confusion, one should always use keydown or keyup events. These events detect events where any key is pressed and one can use e.which to determine what key is pressed and perform action.


I personally like keyup becuase keydown event is called just after pressing the key and hence value of input field lags one character behind the actual input.


Hope it helps !

Changing the text color of your Icons on Desktop in Ubuntu

Recently. I encountered a weird requirement.

I had changes my background image to a white colored image due to which the text on the icons was not visible.

Thus I wanted to change the text color of the icons on Desktop to black.

It turns out that is fairly simple.

Here are the steps :

Go to


NOTE: I use the radiance theme and hence this path. In case you are using a different theme, replace “Radiance” with your theme name.

Here open a file called as “nautilus.css” in a simple text editor.

Somewhere near line 8-10 , there is a desktop mode where you can make your changes.

Find the line


Instead of removing it, comment this out and below that, copy the same line and use the hex code of the color you want to use.

For example, in my case it looks like:


Not a big deal but hope it helps !!