I have a click event with jQuery like that :
$(document).ready(function() {
$("#id_secteur_activite").click(function () {
console.log('ok');
});
});
On firefox and ie9, when i click on my element #id_secteur_activite
, i have the message "ok" in my console.
But when i test on ie 8 and ie7, i have nothing. .click doesn't work on ie<9.
Do you have any ideas ? thanks !
Edit :
<SELECT id=id_secteur_activite name=secteur_activite>
<OPTION selected value="">choisissez d'abord un secteur d'activité</OPTION>
</SELECT>
use .on()
$(document).ready(function() {
$("#id_secteur_activite").on('click',function () {
alert('ok');
});
});
and also use alert
instead of console
.
[DEMO(http://jsfiddle.net/mplungjan/8t8Jh/show/)
All works using a high enough version of jQuery (here edge which is currently v1.9.2pre)
$(document).ready(function() {
/* $("#id_secteur_activite").click(function () {
console.log('click');
});
*/
$("#id_secteur_activite").on("click",function () {
console.log('click');
});
$("#id_secteur_activite").on("change",function () {
console.log('change');
});
});
you can use both click
event and change
event.
$(document).ready(function() {
$("#id_secteur_activite").on('change',function () {
console.log('ok');
});
});