开发者

A jQuery line of code makes my cursor turn to 'text cursor'?

开发者 https://www.devze.com 2023-03-04 02:19 出处:网络
In Firefox my cursor turns into the one you see when you select a text field (I\'m using Ubuntu 11开发者_如何学Go.04).

In Firefox my cursor turns into the one you see when you select a text field (I'm using Ubuntu 11开发者_如何学Go.04).

The problem seem to be the commented line below (because the cursors returns to default or pointer if I comment it):

<script type="text/javascript" >
    $(function(){
        var btnUpload=$('#upload');
        var status=$('#logo-upload-status');
        new AjaxUpload(btnUpload, {
            action: '<?php bloginfo('template_directory'); ?>/upload-file.php',
            name: 'uploadfile',
            /* this is the problem -> onSubmit: function(file, ext){  */
                 if (! (ext && /^(jpg|png|jpeg|gif)$/.test(ext))){
                    status.text('Only JPG, PNG or GIF files are allowed');
                    return false;
                }
                status.text('Uploading...');
            }
            onComplete: function(file, response){
                //On completion clear the status
                status.text('');
                //Add uploaded file to list
                if(response==="success"){
                    $('<li></li>').appendTo('#files').html('<img src="<?php bloginfo('template_directory'); ?>/images/'+file+'" alt="" /><br />'+file).addClass('success');
                    $('#<?php echo $logo_image; ?>').val(file);
                } else{
                    $('<li></li>').appendTo('#files').text(file).addClass('error');
                }
            }
        });

    });
</script>

The button:

   <input type="button" class="background_pattern_button" id="upload" value="Choose Logo" />

Any suggestions?

EDIT:

Firebug Inspector (For some reason the cursor looks normal in the screenshot):

A jQuery line of code makes my cursor turn to 'text cursor'?


Ajax Upload uses a method of a hidden <input type="file" /> which in turn allows you to have a personalised "browse computer" button which will open a file etc etc etc. The problem you are facing is that you cannot change the cursor of the <input type="file" />

You just have to put up with it, or push the input to the left a little with css so the button area gives the default cursor instead of text.

Also your input should have a opacity which makes it invisible to naked eye but it is there none the less [on css]

0

精彩评论

暂无评论...
验证码 换一张
取 消