I was putting together a feature that was meant to find other selects
with same value when I came across this situation:
jQuery('select[name="group2"]').val('emissao');
jQuery('select[name^="group"]').on('change', function(){
console.log(this.value);
var o = null;
console.log(o = jQuery('select[name^="group"][value="'+this.value+'"]'));
console.log(o['selector']);
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script><selectname="group1">
<option value=""></option>
<option value="emissao">Data Emissao</option>
<option value="entrada">Data Entrada</option>
</select>
<select name="group2">
<option value=""></option>
<option value="emissao">Data Emissao</option>
<option value="entrada">Data Entrada</option>
</select>
Note that it already has the new value yet the selector does not find it.
What is the precedence for finding this select
?