Jquery die() method is not working on dynamically generated button in IE7
-
01-07-2021 - |
Вопрос
In my web page i am creating some button dynamically and By using ON binding some event with the button ,on some condition i have to disable this button for that i am using die() method but it is not seems to be working on ie7 ,it is working fine on mozilla and chrome
$('#BtnShow').die('click');
Is there any wayaround for ie7?
Решение
Use .off
when you bind events using .on
.
Use .die
when you bind events using .live
. (Note: both .live
and .die
are deprecated.)
Use .undelegate
when you bind events using .delegate
Use .unbind
when you bind events using .bind
.
Note: When using delegated events, make sure the selector used in .on/.delegate/.live
matches with the selector in .off/.undelegate/.die
Другие советы
.die()
is deprecated now, try using .off()
Не связан с StackOverflow