Skip to content

Instantly share code, notes, and snippets.

@Ilink
Created September 15, 2014 23:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ilink/6e07efb2905f907ef7d2 to your computer and use it in GitHub Desktop.
Save Ilink/6e07efb2905f907ef7d2 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<script src="http://documentcloud.github.com/underscore/underscore-min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
<style id="jsbin-css">
body {
font-family: sans-serif;
}
.box {
border: 2px solid black;
padding: 5px;
width: 150px;
text-align: center;
cursor: pointer;
margin:10px;
}
</style>
</head>
<body>
<div class="box click1">
Click me1
</div>
<div class="box click2">
Click me2
</div>
<script id="jsbin-javascript">
function Clicky(){
this.prop1 = 1;
$(".click1").on('click', function(){
console.log(this.prop1);
});
}
var clicky = new Clicky();
function Clicky2(){
this.prop1 = 1;
function onClick(){
console.log(this.prop1);
}
$(".click2").on('click', function(){});
}
var clicky2 = new Clicky2();
</script>
<script id="jsbin-source-html" type="text/html"><!DOCTYPE html>
<html>
<head>
<script src="http://documentcloud.github.com/underscore/underscore-min.js"><\/script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"><\/script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
<div class="box click1">
Click me1
</div>
<div class="box click2">
Click me2
</div>
</body>
</html>
</script>
<script id="jsbin-source-css" type="text/css">body {
font-family: sans-serif;
}
.box {
border: 2px solid black;
padding: 5px;
width: 150px;
text-align: center;
cursor: pointer;
margin:10px;
}</script>
<script id="jsbin-source-javascript" type="text/javascript">function Clicky(){
this.prop1 = 1;
$(".click1").on('click', function(){
console.log(this.prop1);
});
}
var clicky = new Clicky();
function Clicky2(){
this.prop1 = 1;
function onClick(){
console.log(this.prop1);
}
$(".click2").on('click', function(){});
}
var clicky2 = new Clicky2();
</script></body>
</html>
body {
font-family: sans-serif;
}
.box {
border: 2px solid black;
padding: 5px;
width: 150px;
text-align: center;
cursor: pointer;
margin:10px;
}
function Clicky(){
this.prop1 = 1;
$(".click1").on('click', function(){
console.log(this.prop1);
});
}
var clicky = new Clicky();
function Clicky2(){
this.prop1 = 1;
function onClick(){
console.log(this.prop1);
}
$(".click2").on('click', function(){});
}
var clicky2 = new Clicky2();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment