Hello, I really need help with this task. I want to change the style of a button (which is actually a link) by clicking on it. These buttons are housed within a dynamic child div that changes each time, but the name of the dynamic child div remains constant. Please note: Only one child div will be displayed in the parent div at a time. Here is the style code:
.btn_child {display:block; margin:-1px; border:1px solid; background-color:#428bca; border-color:#357ebd; text-align:left; padding-left:15px; line-height:30px; }
.btn_child:hover {background-color:#3276b1; border-color:#285e8e; }
.btn_child_selected {background-color:#3276b1; border-color:#285e8e; }
And here is the HTML code:
<div id="parent" class="parent_class">
<!--this is a dynamic content and the ID will change. only the name will still the same-->
<div id="dynamic_child1" name="child">
<a class="btn_child" target="_blank" href="" > link1 </a>
<a class="btn_child" target="_blank" href="" > link2 </a>
<a class="btn_child" target="_blank" href="" > link3 </a>
</div>
</div>
IMPORTANT: Clicking on a new button will return the previous one to its default style while changing the style of the newly clicked button.
For more information, you can visit this link: http://jsfiddle.net/c1znyrw5/