I am appending a DIV to an existing DIV. The append is working and showing, but my divs need to be clickable. Currently I cannot get the onclick to work. I have tried to make each append have a unique class or id and still the div is not clickable.
MY JQUERY
$("#searchUsersText2").keypress(function() {
var y = $('#searchUsersText2').val();
if ($('#searchUsersText2').val()){
$.ajax({
type: "POST",
url: '../home/findUser.php',
data: "dataString="+y,
success: function(data) {
$("#searchUsersBodyResults2").empty();
$("#searchUsersBodyResults2").append("<div class='inputs'>"+data+"</div>");
}
});
}
});
$("#searchUsersText2").click(function()
{
$("#searchUsersContainer2").fadeToggle(300);
});
$(".inputs").click(function()
{
alert("SUCCESS");
});
MY HTML
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="http://www.croeberdemo.site40.net/external/listItems.js"></script>
</head>
<body >
<ul id="nav">
<li id="searchUsers2">
<a href="#" id="searchUsersLink2">
<input id="searchUsersText2" placeholder="Search for Users" />
</a>
<div id="searchUsersContainer2">
<div id="searchUsersBodyResults2" class="notifications">
</div>
</div>
</li>
</ul>
</html>