Reputation: 6328
Can you please take a look at this code and let me know why the click
event is not firing ?
$( ".content" ).on("click", function() {
alert( "This is Clicked" );
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
<input type="text" class="form-control" class="content" >
Upvotes: 0
Views: 37
Reputation: 431
Try this
$(document).ready(function(){
$('.content').click(function(){
alert('I have done');
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<input type="text" class="form-control content" />
Upvotes: 1
Reputation: 1
Try substituting <input type="text" class="form-control content" />
for <input type="text" class="form-control" class="content" >
$(".content").on("click", function() {
alert("This is Clicked");
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js">
</script>
<input type="text" class="form-control content" />
Upvotes: 1
Reputation: 230
You have class
twice. Try this:
<input type="text" class="content form-control" >
Upvotes: 1