我試圖將change
事件綁定到選擇標記,但選項很少。如果我將它綁定到select
標記它不起作用。如果我在click
事件綁定到H1
標記,它的工作正常。更改事件不適用於選擇
HTML
<div class="subtitle_block">
<span>Резюме по разделам</span>
<form name='region_filter' action='/jobseek/search_cv/' method='post'>
<select id="id_region" class="" name="region">
<option value="" selected="selected">Все</option>
<option value="3">Донецк</option>
<option value="2">Киев</option>
<option value="1">Харьков</option>
</select>
</form>
<div class="clear_both"></div>
</div>
我想這樣的
$(function(){
console.log($('#id_region')); //this is works
$('#id_region').bind('change', function(){console.log('asdf')}); //this is not works
});
而且像
$(function(){
console.log($('#id_region')); //this is works
$('#id_region').change(function(){console.log('asdf')}); //this is not works
});
即使這樣
$(function(){
console.log($('#id_region')); //this is works
$('#id_region').click(function(){console.log('asdf')}); //this is not works
});
那裏有什麼問題?
uhmm我把你的代碼中的jsfiddle和它的作品... – Jorge