JSFiddle - React, Tailwind, and code Playground
by David Kyle
HTML
<div id="reciprocitationAgreement">
<select>
<option disabled="disabled">-Not Available-</option>
<option>Available</option>
</select>
<br />
<input type="text" name="another-option" />
<br />
<button name="check" id="clickMe">Click Me</button>
</div>
<div class="output"></div>
JavaScript
$.fn.getValue = function () {
var returnValue = "";
switch ($(this)[0].nodeName) {
case "INPUT":
returnValue = $(this).val();
break;
case "OPTION":
returnValue = $(this).text();
break;
default:
returnValue = $(this)[0];
break;
} // end switch
return returnValue;
};
$(function () {
$("#clickMe").click(function (e) {
$("#reciprocitationAgreement option:selected:not([disabled]), #reciprocitationAgreement input").each(function () {
console.log($(this).getValue());
});
});
});