Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8656541
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:18:01+00:00 2026-06-12T15:18:01+00:00

I use (Css 2.1 And Jquery) to style file inputs It Work Fine And

  • 0

I use (Css 2.1 And Jquery) to style file inputs

It Work Fine And every thing work fine to now

Here’s example i’m talking about

Input File Demo

If you are using Firefox Every thing Work fine

But when Using Chrome Can’t select file from first time My Problem

To select file in this demo Its Beside Cv

Here’s My JQuery Code

(function($){
              $.fn.SafyForm = function(){
                   $(".safy_input_file").live("click", function(){
                                     var obj = $(this) ;
                                     obj.prev("input[type=file]").click() ;
                                     obj.prev("input[type=file]").change(function(){
                                         var txt = $(this).val();
                                         obj.children("span").text(txt) ;
                                     });
                   }) ;
                   return this.each(function(){
                         if($(this).is("input[type=file]"))
                                {
                                  $(this).hide().after('<div class="safy_input_file"><span> [ .docx & .doc & .pdf & .rar ] </span><label>اختار ملف</label></div>')
                                }
                   }) ;
              }
        })(jQuery);

        $(document).ready(function(){
              $('input[type=file]').SafyForm() ;
        }) ;

Code After update

(function($){
              $.fn.SafyForm = function(){
                   $(".safy_input_file").live("click",function(){
                                     var obj = $(this) ;
                                     obj.prev("input[type=file]").click() ;

                   }) ;

                   $("input[type=file]").change(function(){
                            var txt = $(this).val();
                            var safyobj = $(this).next('.safy_input_file') ;
                            safyobj.children("span").text(txt) ;
                   });

                   return this.each(function(){
                         if($(this).is("input[type=file]"))
                                {
                                  $(this).hide().after('<div class="safy_input_file"><span> [ .docx & .doc & .pdf & .rar ] </span><label>اختار ملف</label></div>')
                                }
                   }) ;
              }
        })(jQuery);

        $(document).ready(function(){
              $('input[type=file]').SafyForm() ;
        }) ;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T15:18:03+00:00Added an answer on June 12, 2026 at 3:18 pm

    you right, in chrome twice run upload.
    I tested your plugin in fiddle:

    http://jsfiddle.net/EPxkh/61/

    and is correct(1 time run).
    problem must be in other your webpage elements or scripts.

    also try change:

    input[type=file]

    to

    :file

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If it possible to use @import in a .css file to load a style
Please see the jQuery below: I am really wondering how can I use CSS
Using Jquery 1.6.4. I'm attempting to use css to give my app a clue
I'm trying to use jquery and blueprint css to do a (so i thought)
I am trying to use jQuery to basically wrap a bunch of CSS modifications
I use the following jquery statements, $(.resultsdiv:odd).css(background-color, #fff); $(.resultsdiv:even).css(background-color, #EFF1F1); $('.resultsdiv').hover(function() { $(this).css('background-color', '#f4f2f2');
I know it is possible to use jQuery to do something like: $('body').css('cursor','wait'); What
I'm learning how to use jquery with SharePoint. My example draws a red box
Here's my situation: I am editing an application's CSS style sheet. I can ONLY
I'm using code I found for a jquery style sheet switcher. From here: http://www.cssnewbie.com/simple-jquery-stylesheet-switcher/

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.