How to get my html5 feature incompatibility warning to work using javascript -


I've added a form for my webpage that allows for multiple file uploads I input & lt ; Input type = "file" name = "photo_upload []" id = "photo_upload" multiple = "multiple" /> .

I tried to add a warning that appears only if the browser does not support multiple file features. I tried this code:

  & lt; Script type = "text / javascript" & gt; Var testrange = document.createElement ("input") testrange.setAttribute ("multiple", "multiple") (testrange.multiple == "multiple") {document.getElementById ('multiple_verning'). Style.display = 'none'; } & Lt; / Script & gt; & Lt; Div id = "multiple_warning" style = "background: #FFFF99; border: dashed; border width: thin;" & Gt; Sorry, but your browser does not support multiple file uploads feature. & Lt; Br / & gt; If you have more than one photo to send to us, please send it after receiving your compass email. & Lt; / Div & gt;   

But it always displays "Multiple_Warning" regardless how can I treat it properly?

Check the console to see if your test always fails;) testrange.setAttribute ("multiple", "multiple") console.log (testrange.multiple);

You can see this feature with this snippet

  if (! ("Multiple" in testrange)) {Warning ("no multiple uploads is not supported") ; }    

Comments