1
How to select attribute (obligate) of the category that this set, Every time I click the button!!
var btn = document.querySelector("#btn");
var categorias = document.querySelector("#categorias");
btn.addEventListener("click", selecObriga);
function selecObriga(e){
e.preventDefault();
}
<form>
<select id="categorias" name="categorias">
<option value="1" obriga="0">Cores</option>
<option value="2" obriga="1">Animais</option>
</select>
<input id="btn" type="submit">
</form>