Erdem Ece
Erdem Ece

Reputation: 1775

When something entered into input do something with jquery

Hi thanks for reading.

I have a input box which is for urls to be given. When an user enters a url the user has to click on a button to get values from it.

which is this.

jQuery(document).ready(function($){

  $(".button-class").click( function(event) {
   //do something
 )};
)};

Eventually all users click on the button. What I want to do is as soon as they entered the url or something the script should be triggered.

is there anything like that?

jQuery(document).ready(function($){

  $(".button-class").entered( function(event) {
   //do something
 )};
)};

thanks.

Upvotes: 0

Views: 360

Answers (1)

schabluk
schabluk

Reputation: 708

You can listen for a change event:

$( "input[type='text']" ).change(function() {
  // Check input( $( this ).val() ) for validity here
});

Another options are keypress and keydown functions.

Upvotes: 1

Related Questions