为了账号安全,请及时绑定邮箱和手机立即绑定

jquery不起作用,点击delete时不弹出提示框,直接跳转到删除页面

jquery不起作用,点击delete时不弹出提示框,直接跳转到删除页面

回到原点co 2017-05-07 00:35:49
<%@ page language="java" contentType="text/html; charset=UTF-8"    pageEncoding="UTF-8"%>    <%@ taglib prefix="s" uri="/struts-tags"%><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Insert title here</title>            <script type="text/javascript" src="scripts/jquery-1.9.0.min.js"></script>            <script type="text/javascript">                         $(document).ready(function(){                    //点击delete时,弹出确定要删除xx的信息                     $(".delete").click(   function(){                             var flag =confirm("确定要删除信息 ?");                             if(flag){                                                         }                             //取消超链接的默认行为                             return false;                             });                     })            </script></head><body> <h4>Employee List Page</h4> <s:if test="#request.employees ==null //#request.employees.size() == 0"> 没有员工信息 </s:if> <s:else> <table border="1" cellpadding="10" cellspacing="0">             <tr>                     <td>ID</td>                     <td>LASTNAME</td>                     <td>EMAIL</td>                     <td>BIRTH</td>                     <td>CREATETIME</td>                     <td>DEPT</td>                     <td>DELETE</td>             </tr>             <s:iterator value="#request.employees">                     <tr>                         <td>${id}</td>                         <td>${lastName}</td>                         <td>${email}</td>                         <td>${birth}</td>                         <td>${createTime}</td>                         <td>${department.departmentName}</td>                         <td>                         <a href="emp-delete?id=${id}" class="delete">Delete</a>                         <input type="hidden" value="${lastName}">                         </td>             </tr>          </s:iterator> </table> </s:else> </body></html>
查看完整描述

1 回答

?
街角小林

TA贡献7条经验 获得超1个赞

因为点击的是个a标签啊,有默认跳转的事件,你得先禁掉,e.prevetDefault()
查看完整回答
反对 回复 2017-05-09
  • 1 回答
  • 0 关注
  • 1439 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信