JSFiddle - React, Tailwind, and code Playground
HTML
<label>
<input type="checkbox" data="1"><span>Air Conditioning</span>
</label>
<label>
<input type="checkbox" data="wes"><span>Cable TV Service</span>
</label>
<label>
<input type="checkbox" data="3"><span>Private Bathroom</span>
</label>
JavaScript
var room_features = "";
$('[type=checkbox]').change(function () {
var data = "-" + $(this).attr('data');
if (room_features.indexOf(data) != -1) {
room_features = room_features.replace(data, "");
alert(room_features);
} else {
room_features = room_features + data;
alert(room_features);
}
})