php - jquery.keypad.js not working for dynamically added text box -


i'm using jquery.keypad.js show special characters(ÁÃÅÀ...) in text box user can select. working fine first field of text box, when add same text field clicking on "add more" button not workin. i'm calling function once again after clicking "add more" though not working. issue?

$(function () {         $('.keypadactive').keypad({keypadclass: 'flatkeypad',keypadonly: false,               layout: [<? echo  utf8_encode("'ÁÃÅÀÂÄááåàâ䯿ßÇçÐÉËÈÊéëèê', 'ÌÎÍÏìîíïÑñÒÔÖØÓÕðòôöøóõÚÜÙ' ,'ÛùûúüÝýÿÿ¡,°¹²³º¼½¾±µ', '£¥\$¢þ§©®¯·¨¬«»¦ª¶'");?> ], prompt: '',showon: 'button', buttonimageonly: true, buttonimage: 'images/spl.jpg'}); });  $('.add_more').live('click',function(){     $(this).parent().parent().parent().parent().append($('#add_me_next').html());     $(this).parent().html('<label class="w50">&nbsp;</label><input type="button" name="remove" value="remove" class="button remove" />');      settimeout('keypadcall()',1000);  });  function keypadcall(){     $('.keypadactive').keypad({keypadclass: 'flatkeypad',keypadonly: false,                   layout: [<? echo  utf8_encode("'ÁÃÅÀÂÄááåàâ䯿ßÇçÐÉËÈÊéëèê', 'ÌÎÍÏìîíïÑñÒÔÖØÓÕðòôöøóõÚÜÙ' ,'ÛùûúüÝýÿÿ¡,°¹²³º¼½¾±µ', '£¥\$¢þ§©®¯·¨¬«»¦ª¶'");?> ], prompt: '',showon: 'button', buttonimageonly: true, buttonimage: 'images/spl.jpg'}); } 

try event delegation closest parent available when dom ready or $(document) .on() handler:

$(document).on('click', '.add_more', function(){     $(this).parent().parent().parent().parent().append($('#add_me_next').html());     $(this).parent().html('<label class="w50">&nbsp;</label><input type="button" name="remove" value="remove" class="button remove" />');      settimeout(keypadcall,1000);  }); 

and try removing () keypadcall function in settimeout().


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

javascript - Image onload event not firing in firefox -

sql - ASP.NET SqlDataSource, like on SelectCommand -