jquery - dynamically appending elements on dynamically created elements -
i have modal dynamic content. e.g. can create item typing someting in textbox , hit enter. after hit enter want notification below textbox, dynamically created.
normally i'd put in .js.erb
$("#idoftextbox").append("some waring") but mentioned textbox id: idoftextbox created dynamically , because of approach doesnt work.
i read plenty , think understand problem, normaly you'd this
$(document).on("click", "#idoftextbox", function(){ $(this).append("some warning"); }; but don't want bind specific event, want append message when controller renders .js.erb file
i thought mb .on("load", might work, had no success far.
i'd appreciate help.
try :
$('body').append("<div id='idoftextbox'></div>"); $(document).find('#idoftextbox').append("some value");
Comments
Post a Comment