I have a list of buttons. When one is clicked it appends the text "selected'" to the existing value of the button.
When one button is clicked I want to removed the text "selected" from the other buttons if the text is there.
Basically it should be like - Loop through all the buttons in the area (they all have a class of searchResult) and remove the value "selected" from each button if it is there.
Here is the code for each button:
<input type="button" class="searchResult" onclick="$(\'#usersToSend > *\').css(\'background-color\', \'#fff\');
var oldValue = this.value;
this.value=\'(selected) \' + oldValue; this.style.backgroundColor = \'#51CA3E\';
document.getElementById(\'hiddenUserFlag\').value = \''.$row['id'].'\';"
value="'.$row['username'].'">
Here is the code bit to pay attention to:
$(\'#usersToSend > *\').css(\'background-color\', \'#fff\');
var oldValue = this.value;
this.value=\'(selected) \' + oldValue;
this.style.backgroundColor = \'#51CA3E\';