Created
June 22, 2017 01:52
-
-
Save flpPaiva/71e7f305a500f5a8368e2f36bdfa3fe3 to your computer and use it in GitHub Desktop.
JS Bin // source http://jsbin.com/wiwoluc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
<script src="https://code.jquery.com/jquery-3.1.0.js"></script> | |
</head> | |
<body> | |
<button class="c1">C1</button> | |
<button class="c2">C2</button> | |
<div id="box"></div> | |
<script id="jsbin-javascript"> | |
var $doc = $(document); | |
var c1 = function(){ | |
console.log('oi') | |
}; | |
var c2 = function(){ | |
var newNode = $('<button>C1</button>') | |
.addClass('c1'); | |
$("#box").append(newNode); | |
$('.c1').off().on('click', c1); | |
// $('.c1').bind('click', c1); | |
}; | |
$('.c1').on('click', c1); | |
// $doc.on('click', '.c1', c1); | |
$doc.on('click', '.c2', c2); | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">var $doc = $(document); | |
var c1 = function(){ | |
console.log('oi') | |
}; | |
var c2 = function(){ | |
var newNode = $('<button>C1</button>') | |
.addClass('c1'); | |
$("#box").append(newNode); | |
$('.c1').off().on('click', c1); | |
// $('.c1').bind('click', c1); | |
}; | |
$('.c1').on('click', c1); | |
// $doc.on('click', '.c1', c1); | |
$doc.on('click', '.c2', c2);</script></body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var $doc = $(document); | |
var c1 = function(){ | |
console.log('oi') | |
}; | |
var c2 = function(){ | |
var newNode = $('<button>C1</button>') | |
.addClass('c1'); | |
$("#box").append(newNode); | |
$('.c1').off().on('click', c1); | |
// $('.c1').bind('click', c1); | |
}; | |
$('.c1').on('click', c1); | |
// $doc.on('click', '.c1', c1); | |
$doc.on('click', '.c2', c2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment