-5

I added dynamicaly input field with jquery. And now I want to make event with jquery "focusout" but its not triggering... any ideas ?

This input is created dynamicaly with jQuery.

<input type="text" id="input_id" name="input_name" value="" />

$("#input_id").focusout(function(){
     alert("test");
});

SOLVED UPDATE:

$("#input_id").live('focusout', function() {
andys
  • 708
  • 3
  • 11
  • 29

2 Answers2

0

While you creating input field give an id for the input element. <input type='text' id='myfield' /> Now you can write code for focus out / blur like below

$("#myfield").blur(function(){
    // Your code here
   // If you want to Get the value from that field ?
   var val1 = $("#myfield").val();
});
Radhakrishna Rayidi
  • 510
  • 2
  • 9
  • 24
  • as you can see the ID is already created ... – andys Mar 19 '13 at 17:26
  • Put your jQuery code in `$(document).ready(function(){ // your jquery code goes here });` some times this will be needed. Or you can try .hover instead that contains two function on mouseover and mouseout – Radhakrishna Rayidi Mar 19 '13 at 17:30
0

What you are looking for is

$("#input_id").live('focusout', function() {
flup
  • 26,937
  • 7
  • 52
  • 74
andys
  • 708
  • 3
  • 11
  • 29