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

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

python - How do I create a list index that loops through integers in another list -

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -