无法正常工作,请移动到另一页
Does not work properly move to another page
我有4个按钮。
其中三人正在出示执照。其中一个标题为"企业"的页面必须转到另一个页面。
不幸的是,当我点击"企业"时,会显示许可证,然后页面转到另一个页面。
我如何做到不传递代码来显示许可证,而是立即传递到另一个页面?
我的代码:
$('input[title="enterprise"]').click(function(){
window.location.href = "/contact";
});
$('input[type=button]').click(showLicence).each(function() {
this.version = this.title;
this.title = "Buy ";
switch(this.version) {
case 'basic':
this.title += 'Basic';
break;
case 'standard':
this.title += 'Standard';
break;
case 'business':
this.title += 'Business';
break;
}
});
尝试使用:not
$('input[type=button]:not([title="enterprise"])').click(showLicence).each(function() {
更改第二个事件处理程序,以便排除enterprise
按钮:
$('input[type=button]:not([title="enterprise"])').click(showLicence).each(function() {
添加一个唯一的类来分隔这两个功能。
例如:
<button class="enterprise">Enterprise</button>
<button class="normal">Basic</button>
<button class="normal">Standard</button>
<button class="normal">Business</button>
然后在JS中做一个细微的更改:
$('.enterprise').click(function(){
window.location.href = "/contact";
});
$('.normal').click(showLicence).each(function() {
this.version = this.title;
this.title = "Buy ";
switch(this.version) {
case 'basic':
this.title += 'Basic';
break;
case 'standard':
this.title += 'Standard';
break;
case 'business':
this.title += 'Business';
break;
}
});
您可以根据需要将所有属性添加到按钮中。希望这是有道理的。
也许您可以使用"default"switch关键字(或添加"Enterprise"案例):
$('input[type=button]').click(showLicence).each(function() {
this.version = this.title;
this.title = "Buy ";
switch(this.version) {
case 'basic':
this.title += 'Basic';
break;
case 'standard':
this.title += 'Standard';
break;
case 'business':
this.title += 'Business';
break;
default:
window.location.href = "/contact";
}
});
相关文章:
- 传递表单值并移动到另一页
- 使用滑动手势从一页移动到另一页
- 从页面上点击的链接中删除数据,然后移动到下一页&在CasperJS中重复
- 移动到对象的下一页
- 移动到 php 表的下一页而不刷新
- 使用smarty单击确认后移动下一页
- 从一页移动到另一页
- 当页面在每页上空闲3秒时,移动到下一页和后续页
- 当设置为导航栏固定顶部时,一页引导导航栏切换在移动模式下无法正常工作
- 页面刷新或移动到另一页后保留setTimeout()
- 如何在修改后将堆叠的图像移动到另一页
- 无法正常工作,请移动到另一页
- 重定向到移动网站的每一页或只是根索引
- jQuery移动向左/向右滑动到下一页不顺畅
- jQuery移动版-移动到下一页/上一页-点击后执行两次操作
- 如何使用jQuery访问已“移动”的DOM元素?绕着这一页
- 当手动键入url以移动到下一页时,Chrome加载脚本两次
- 页脚在移动到下一页时隐藏
- 我如何提交表单,并在同一时间移动到下一页
- 如何将文本从一页移动到另一页的形式