117
rated 0 times
[
122]
[
5]
/ answers: 1 / hits: 15574
/ 7 Years ago, sat, october 21, 2017, 12:00:00
I have the following elements in a html document
<div id=u11 class=ax_default image data-label=image1>
<img id=u11_img class=img src=images/image1_u11.png>
</div>
<div id=u23 class=ax_default image data-label=image2>
<img id=u23_img class=img src=images/image2_u23.png>
</div>
I want to write a javascript onclick function for another element that set image2 src
to image1 src
The problem is that ids are random so I cannot use them but fortunately I can use the data-label
to get the external div objects with $('[data-label=image1]')
¿How can I set the src in the inner img?
More From » html