Following this post, I am trying to bind a keydow
event handler on all dynamically elements which id starts with id_phone-
and finished with -value
. For example, id_phone-3-value
should math, whereas id-phone-3-value
should not.
To achieve this, I tried to come up with the code below:
$(document).on('keydown', '[id^=id_phone-_][id$=_-value]', function(){
console.log('test');
});
...which, unfortunately, does not work for me. What am I doing wrong here ?