With jquery on several event i required to add elements but on that elements click event is not triggered. I tried to add the listener in the ready function also but it doesn't worked. Anyone please help.
$(document).ready(function(){
$('#button').click(function(){
var toAdd = $('input[name=checkListItem]').val();
$('div.list').append('<div class="item-next">' + toAdd + '</div>')
});
});
$('.item-next').click(function(){
alert()
});
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<!DOCTYPE html>
<html>
<head>
<title>Find Listeners</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css"/>
<script type="text/javascript" src="script.js"></script>
</head>
<body>
<h2>Find Listeners</h2>
<form name="checkListForm">
<input type="text" name="checkListItem"/>
</form>
<button id="button">Click to Add</button>
<br/><br/><br/>
List
<div class="list"></div>
</body>
</html>