HTML
<div id = "btnsdhd" class="btn-group">
<button type="button" id="31" value="SD" class="btn btn-default">SD</button>
<button type="button" id="32" value="HD" class="btn btn-default">HD</button>
</div>
JS
var btnsdhdDiv = $('#btnsdhd');
var getsdhd = function () {
// Get all sdhd's from buttons with .active class
var sdhd = $('button.active', btnsdhdDiv).map(function () {
return $(this).val();
}).get();
// If no sdhd's found, get sdhd's from any button.
if (!sdhd || sdhd.length <= 0) {
sdhd = $('button', btnsdhdDiv).map(function () {
return $(this).val();
}).get();
}
return sdhd;
};
The above code captures the values of the buttons and places it in the variable getsdhd
If none of the buttons are selected by default it captures both the values (SD,HD) I want to modify the if statement and add a third value NC to the variable when to no buttons are selected
I want it to look like (SD,HD,NC) when no buttons are slected.
I tried to use the .push() method but that didnt work.
Any leads would be helpful.