47
rated 0 times
[
53]
[
6]
/ answers: 1 / hits: 14929
/ 9 Years ago, sat, august 8, 2015, 12:00:00
I have a set of dynamically generated div elements like:
<div on-click=selected>one</div>
<div on-click=selected>two</div>
<div on-click=selected>three</div>
<div on-click=selected>four</div>
<div on-click=selected>five</div>
<div on-click=selected>six</div>
<div on-click=selected>seven</div>
I want to change the background color of div on which it is clicked and lose it when another div is clicked.
I could achieve this using tabindex, but I want to retain it until I click it on the another div or clear it intentionally, which tabindex does not provide.
How can I acieve it using javascript?
More From » html