Sent from losPhone

> On Dec 4, 2013, at 7:18 AM, chun zhang <[email protected]> wrote:
> 
> <!DOCTYPE html>
> <html>
> <head>
> <script src="
> http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js";>
> </script>
> <script>
> $(document).ready(function(){
>  $("p").click(function(){
>    $("#test").click();
>  });
> });
> </script>
> </head>
> <body>
> <p>If you click on me, I will disappear.</p>
> <p>Click me away!</p>
> <p>Click me too!</p>
> <input id="test" type="file" style="display:none;">
> </body>
> </html>
> 
> Run this code on android browser, click p will never show file dialog.
> But if I remove style="display:none;", let the input show, it works.
> Why?

Correct me if I am wrong, but I believe it is because it can't open a dialog 
for something it doesn't know is there. If you want it loaded on the page but 
hidden, use visibility or opacity, not display. Display none just creates an 
empty placeholder in the DOM I believe. Visibility or opacity, the elements in 
the DOM but not visible, but still accessible. 

Try this code. 

$(document).ready(function(){
 $("p").on('click', function(event){
   $("#test").css('display', 'block').click();
 });
});

Best,
Karl
______________________________________________________________________
css-discuss [[email protected]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to