Get input data using Jquery

2

I'm trying to get the value of an input, I do not want to use a button and I want to get the value when I stop selecting the text box in which the data is being entered, any idea of how to start ?? / p>     

asked by Christian 01.02.2018 в 04:34
source

2 answers

3

You can use the function blur of jquery, basically this function is used when the "focus" of an element is removed. Example:

$( "#input" ).blur(function() {
      alert( "Se ha quitado el foco del elemento");
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

Has clic en el input y luego en un espacio en blanco:
<input id="input" type="text"/>
    
answered by 01.02.2018 / 04:41
source
0

It will only work if the input already has a value when loading the page

$(document).ready(function(){
 cedula = $("#iddelinput").val();
  alert(cedula);
)}
    
answered by 01.02.2018 в 04:39