I have long understood that for dynamically added content, adding listeners and events, such as click and focus, should be done using $(document).on('click','[ID]', function(){}); .... etc.
However, what I'm trying to do is change the HTML value for a specific element that has been dynamically added.
For example, I use this code to add an element:
$('.friend_chooser_pop').html("<div id='#friend_chooser_list'></div>");
Now, how do I access #friend_chooser_list and set its HTML value? None of these works:
$('#friend_chooser_list').html('something'); document.getElementById('friend_chooser_list').innerHTML = 'something';
source share