How does javascript-jquery open the input file selection box?

Source: Internet
Author: User
I first wrote a & amp; lt; inputtype & quot; file & quot; name & quot; file & quot; id & quot; fileupdate & quot; & amp; gt; then I wrote a tag named a. the content written in jquery is {code ...} however, there is no response after clicking? Okay, in the end, we can only use abs to locate and solve the problem... the effect is achieved... I first wrote

Then I wrote a tag. the content written in jquery is

$('a').on('click', '', function() {    $('#fileupdate').click();});

However, there is no response after clicking?

Well, in the end, we can only use abs positioning to solve the problem... the effect is achieved, and it is a little unhappy.

After selecting a file, what does jquery use to trigger my next operations, such as getting a file. What triggers do I use?

Reply content:

First, I wrote

Then I wrote a tag. the content written in jquery is

$('a').on('click', '', function() {    $('#fileupdate').click();});

However, there is no response after clicking?

Well, in the end, we can only use abs positioning to solve the problem... the effect is achieved, and it is a little unhappy.

After selecting a file, what does jquery use to trigger my next operations, such as getting a file. What triggers do I use?

Refer to this question
Http://segmentfault.com/q/1010000004322570
Click events generated by js cannot bring up the Upload file selection box.

You can observe the click events generated by js.event.isTrusted == falseAnd the actual click events in your browserevent.isTrusted == true

You can call the click () method on the hidden file input box.

The file bullet box cannot be directly triggered using Javascript.

But the subject wants to ask is to trigger the file bullet box with the tag.

In this way, you can

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.