When i add to div values from input, i need to click on checkbox so its alert("checked"). My code not working correctly. Can u please tell me what i've been doing wrong.
Here is my code
HTML:
<div class="container">
<form>
<p>Title:</p>
<input type="text" id="title">
<p>Link:</p>
<input type="text" id="link">
</form>
<br>
<button class="btn btn-success">Add</button>
</div>
<div class="content" style="margin-top:50px"></div>
JQuery:
$(function() {
$(".btn-success").click(function(){
var title_val = $("#title").val();
var link_val = $("#link").val();
$(".content").append('<div class="col-xs-6 col-md-4"><ol class="breadcrumb"><h4>'+title_val+'</h4><input type="checkbox" id="checkbox"></ol><a href="http://'+link_val+'" class="thumbnail"></a></div>');
});
$("#checkbox").click(function(){
if($(this).is(":checked")) {
alert("Checked");
}
});
});