I have these elements on my site that are dynamically added to the jQuery function document.ready.
The problem is that I cannot select this element using regular jQuery selectors. JavaScript works fine in IE9 and other browsers. I think the reason is that this does not work, because the content I'm trying to change is being added dynamically.
How to solve this problem?
the code:
$('.dynamic').each(function(index)
{
$('textarea, input[type=radio], input[type=checkbox], select, input[type=text]', this).each(function()
{
var array = $(this).val().split('|||');
var elements = new Array();
var target = String('.dynamic_'+$(this).attr('id'));
$(target).each(function() //this does nothing in ie7 and 8, seems the target selector is messed up :S
{
elements.push($(this));
});
for (val in array)
{
var count = Number(val);
$(elements[count]).val(array[val]);
}
});
});
source
share