[英]Button with class name click event not working
I have button with class name of "sldprv" but when in doucment ready I checked that button with class clicked or not. 我有一个类名为“ sldprv”的按钮,但是在准备好文档时,我是否单击了类就选中了该按钮。 its not working and i am getting this error in chrome.
它无法正常工作,我在Chrome中收到此错误。 and in fire fox it's not even working
在狐狸中甚至无法正常工作
$(".sldprv").click(function(e) {
alert('click');
e.preventDefault();
});
but with button Id it is working. 但是使用按钮ID可以正常工作。
I know there's too little basic I have missed but I can't see god!! 我知道我错过的基本知识太少了,但是我看不到上帝!
[edited] To explain you bit more on this... [编辑]为了进一步说明您...
I am working this code with Jquery Wizard that I am adding this class to the previous button only in the first step and removing that after follow the lines of code edited in the plug in js 我正在使用Jquery向导处理此代码,即仅在第一步中将此类添加到上一个按钮,然后按照js插件中编辑的代码行将其删除
if ( state.isFirstStep || o.unidirectional ||
state.step.hasClass( o.stepClasses.unidirectional ) ) {
//TO DO: back to slide
this.elements.backward.addClass("sldprv");
} else {
this.elements.backward.removeAttr( disabled );
this.elements.backward.removeClass("sldprv");
}
so that I can catch the previous button only at the first step and do my own animation 这样我才可以在第一步中抓住上一个按钮,然后做自己的动画
Hope you guys got the idea and what the issues is. 希望你们有想法,问题出在哪里。
Look this: http://jsfiddle.net/fXb6s/1/ . 看一下: http : //jsfiddle.net/fXb6s/1/ 。 I just add jQuery as lib for it.
我只是将jQuery添加为lib。
$(document).ready(function() {
$(".sldprv").click(function(e) {
alert('click');
e.preventDefault();
});
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.