0

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" >

3 Answers 3

1

You have class twice. Try this:

<input type="text" class="content form-control" >
Sign up to request clarification or add additional context in comments.

Comments

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" />

Comments

1

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" />

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.