jquery - Why is the class of my dynamically created element not recognised? -


this question has answer here:

i have textbox. if selected , hit tab key, new line open. works fine far. however, same action doesn't work in dynamically created textbox. if has same class original textbox called on. tried find explanation on internet, couldn't get/understand right answer. please me?

http://jsfiddle.net/rzclm/1/

$('.list').keydown(function(key){     if(key.which === 9) {         $('.ingredients_list').append('<li><input class="list" type="text"/><i><img class="remove" src="images/remove.svg"></i></li>');      } });  

use $(document).on target dynamically created elements:

$(document).on('keydown', '.list', function(key){     if(key.which === 9) {         $('.ingredients_list').append('<li><input class="list" type="text"/><i><img class="remove" src="images/remove.svg"></i></li>');      } });  

jsfiddle.


Comments

Popular posts from this blog

HTTP/1.0 407 Proxy Authentication Required PHP -

curl - PHP fsockopen help required -

c# - Resource not found error -