Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
  <body>
<input type="button" id="tb" value="this is a button" width=100%/>
  <p id="pout"></p>
  
</body>
</html>
 
body {
  font-size: 2em;
  width: 320px;
}
#pout {
  width: 320px;
}
#tb {
  width: 320px;
}
 
function getFormattedDate() {
    var date = new Date();
    var str = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + "&nbsp;" +  date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds() + "." + date.getMilliseconds();
    return str;
}
function TouchClick(sel, fnc) {
  $(sel).live('touchstart click', function(event){
        event.stopPropagation();
        event.preventDefault();
        if(event.handled !== true) {
            fnc(event);
            event.handled = true;
        } else {
            return false;
        }
  });
}
$(document).ready(function () {
    TouchClick("#tb", function() {
        $("#pout").html(getFormattedDate()+"<br/>"+$("#pout").html());
    });
});
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
mooflypro
0viewers