javascript - HTML/jQuery Help me with this code? -


i've been trying hard on no win.

i have button , div. when user clicks button file browser opens , allows user choose image. image gets added div. that's front image.

i've got code that. wanted duplicate controls user can add image. doesn't seem work. me fix code

or

if guys can suggest better alternative amazing.

here's jsbin demo:

http://jsbin.com/pulug/1/

html:::

    <html>     <head>         <script src="http://code.jquery.com/jquery-latest.js"></script>     </head>     <body>         <fieldset>             <legend>choose front image</legend>             <input type=file id='file' class="button" onchange="startread()"/>             <div id="dragherefront" >drop files here</div>               <div id="manualfront"></div>         </fieldset>         <fieldset>             <legend>choose image</legend>             <input type=file id='file' class="button" onchange="startread()"/>             <div id="draghereback" >drop files here</div>               <div id="manualback"></div>         </fieldset>     </body>     </html> 

css::

 #dragherefront{      width: 128px;      height: 128px;      background-color: rgba(221,214,155,0.4);      border: 1px dashed black;      text-align: center;      position: absolute;      opacity: 0;      overflow: hidden;  }   #draghereback{      width: 28px;      height: 128px;      background-color: rgba(221,214,155,0.4);      border: 1px dashed black;      text-align: center;      position: absolute;      opacity: 0;      overflow: hidden;  }   #manualfront{      width: 128px;      height: 128px;      overflow: hidden      background-color: rgba(221,214,221,0.3);      border: 1px dashed black;      overflow: hidden;      z-index: 0;  }   #manualback{      width: 128px;      height: 128px;      overflow: hidden      background-color: rgba(221,214,221,0.3);      border: 1px dashed black;      overflow: hidden;      z-index: 0;  } 

both inputs have same id file. cant copy code 1:1, need change ids (for example set in first code snipet file1 , in second file2). same divs. , have rewrite code bit works multible fields.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

jsf - How to ajax update an item in the footer of a PrimeFaces dataTable? -

django - CSRF verification failed. Request aborted. CSRF cookie not set -