Im a completely noob on js, and i want to know if i want two or more dom element be connected( which means if i got one of them , then i can get another), what is the most currect way?
I tried use id as a simbol, but what if i want to connect more doms?
what im using now is like:
<div id="area_A>
<div id="block_1"></div>
</div>
<div id="area_B">
<div id="block_2"></div>
</div>
$("#block_1").attr("connect_target","#block_2")
and then i can do
$("#" + $("#block_1").attr("connect_target"))
to get “block_2”
but it is so unclear to read and i found that i cant use an array like:
var id_array = ["block_2","block_3","block_4"]
$("#block_1").attr("connect_target",id_array)
to get more id that i need
I believe there are some more clever way to solve my needing, and i really need to know what are they
Thanks for any knowledge or experience sharing to me!