My Blog

Archive for the ‘JavaScript’ Category

Multiple File Upload plugin for jQuery and Cancel button

Thursday, November 20th, 2008

QuocKien here ask me to help him with Multiple File Upload plugin and cancel button

This the most easy way I think

it’s this simple js code (cancel button will work for second multi input file)

$(document).ready(function(){
        $(’.multi’).MultiFile();
        $(’.multi2′).MultiFile();
       

         $("#cancel_but").click(function() {
            $(".multi2").parent().find(’span a’).each(function() {
                $(this).click();
            });
        })

});

where is .multi2 - it’s selector of your multi file input

simple html

<input type="file" class="multi" />
<input type="file" class="multi2" /><input type="button" value="cancel" id="cancel_but" />

 

I hope this help

Jquery rock star!!!!

Wednesday, September 3rd, 2008

go to jquery.com/ and press Konami code !!! And  lets rock!!!!!

Multiple File Upload plugin for jQuery and IE7 and jQuery validation form

Wednesday, May 14th, 2008

All of you, maybe, know about this super Multiple File Upload. But when I start use it I have a strange things in IE7. I know it you could see it on the plugin website. (Select one file and the set focus again to this field or just try to upload another file).

bug

 

So have I fix this bug.

1. open jquery.MultiFile.js some with editors

2. after

        /// now let’s use jQuery
        slave = $(slave);

insert  this

        slave.attr("name",(slave.name || $(MASTER).attr(’name’) || ‘file’));
        slave.attr("id",(slave.id || MASTER.generateID(slave.i)));
        slave.val(”);
        slave.focus();

3. change

        // Remove element, remove label, point to current
                                        if(slave.i==0){
                                            $(MASTER.eCur).remove();
           MASTER.eCur = slave;
                                        }
                                        else{
                                            $(slave).remove();
                                        };

to

$(slave).remove();

 4. Thats all!

Now problem with jQuery validation plugin.

If you have a error message about that you should enter data less or equal some number.  You should replace all ".max" to ".maximum". Thats all too.

It was very helpful for me, so I hope it will be helpful for you!. If you have any question just ask me.

Super Mario in 14kB Javascript

Thursday, April 10th, 2008

from: blog.nihilogic.dk

Mario

Regular version: no music or with music

Double size: no music or with music

The script has been compressed to 14kb with the YUI compressor. Here’s the uncompressed script (35kb),