Some jQuery code worth knowing

using jQuery with select boxes


Getting the number of elements:



getting the value (not the option text) from multiple select box option


Removing selected items from a multiple select box:

 jQuery("#select_id"+" :selected").each(
        //alert("removing "+);


Hide a select box under internet explorer

Sometimes you need to hide a select tag.

in HTML, the usual solution is

 <select name ="myname" id="myid" 
                multiple="multiple" hidden>

However, this will (obviously) will not work under MSIE even on the current version which is 9.

in order to bypass this MS bug, a css solution (open a separate css file) must be used:

    display:  none;

and then:

 <select name ="myname" id="myid" 
                multiple="multiple" hidden class="hide">

This will work on explorer 6 and above. note that if you need to un – hide this, you have to take care of the class as well.

MS, what can you do…


Resolving drupal ftp error when installing modules

When installing a new drupal site under Linux, you may get this annoying error when trying to install a module:

So what? install an FTP server? NO.

This is clearly a permission error, however, setting folder permissions to 777 (or 666 😉 ) just won’t do it.

The thing is, the user log into Apache needs to be the owner of this folder.

So, to remedy this, use:
chown -R  www-data /var/www/dp7/sites/default

assuming you installed under /var/www/ which is the default in ubuntu.