html - After ajax request jquery can't find the correct div -


for project load html file populate divs directly inserting html content divs. problem is, have many elements has div inside them same id. causes problem select correct 1 i.e. $('#div_name'). finds wrong one.

example

how can solve problem.

update

$('.to_be_filled:eq(1)').children('#graph_container').css('background-color', 'red'); $('.to_be_filled:eq(2)').children('#graph_container').css('background-color', 'green'); 

since eq() supplied index zero-based, select 2nd , 3rd need select eq(1),eq(2)...

here fiddle


Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -