Javascript Contains Prototype

I always hated using the indexof method to detect strings in javascript. I found a nice prototype method which makes these kinds of checks easier.

Returns true or false.

 

Loop Through Multiple File Mimetypes

I needed to check mimetypes to be sure the user knew right away if one of the files they wanted to upload was accepted. Here is (most of) the code I ended up using. You will need to edit to fit your needs.

Here is the HTML being used.

Check out how to get the WordPress mimetype array from PHP into Javascript here.

Copy PHP Array to Javascipt Object

I often need to work with data client side that is returned from the server. Found this neat piece of code which I used to get the available mimetypes so I can validate client side that the file the user is attempting to upload is accepted.

Detect IE Browsers 6-10

Everyone hate IE. Thanks for making our lives hell and halting progress Microsoft.

Here is a simple bit of code which will help to detect an IE browser.

 

Replace Gravity Forms Selects

I had an earlier post about cross browser safe select replacements. This is a function which replaces the gravity forms plugin select drop downs with those cross browser safe drop downs.

CSS styles. You will need to edit to fit your needs.