Advertisement
Guest User

Untitled

a guest
Jan 5th, 2019
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rails 0.37 KB | None | 0 0
  1. $(document).on "turbolinks:load", ->
  2.   readURL = (input) ->
  3.     if input.files and input.files[0]
  4.       reader = new FileReader
  5.  
  6.       reader.onload = (e) ->
  7.         $('#image_upload_preview').attr 'src', e.target.result
  8.         return
  9.  
  10.       reader.readAsDataURL input.files[0]
  11.     return
  12.  
  13.   $('#product_picture').on 'change', ->
  14.     readURL this
  15.     return false
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement