JSFiddle - React, Tailwind, and code Playground

by pritishvaidya

HTML

<script src="//code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="//code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
<link rel="stylesheet" href="//code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
<h3>
    Click on the box taphold to see your image to be downloaded.Sample image as uploaded from the web
     
</h3>
<img src="http://i.imgur.com/JzdY53y.jpg" id="image" />
<div class="box">
</div>

CSS

div.box {
    width: 3em;
    height: 3em;
    background-color: #108040;
  }
  
  img {
    width: 250px;
    height: 250px;
  }

JavaScript

$(function() {
  $("div.box").bind("taphold", tapholdHandler);

  function tapholdHandler(event) {
    alert('Do you want to save the image or however it works in ipad');
    var a = document.createElement('a');
    a.href = "http://i.imgur.com/JzdY53y.jpg";
    a.download = 'JzdY53y.jpg';
    alert("goes till here1"); //just a check
    a.click();
    alert("goes til here 2"); //just a check
  }
});