I have a bunch of these select fields..
<select name="options[0][option_group_id]" />
<select name="options[1][option_group_id]" />
<select name="options[2][option_group_id]" />
<select name="options[new3][option_group_id]" />
I want to assign an onchange event like the following where \S is the wildcard for the keys 0,1,2,new3…:
<script>
$("select[name^='options[\\S*][option_group_id]']").live("change", function(){
alert('Houston we have contact!');
});
</script>
But it does not work. What do I put to make it work?
Just split it to 2 expressions: one for the beginning of the name, and another for its ending:
http://jsfiddle.net/zerkms/enZLu/