html的data-*属性

2023-10-12 14:13:25 浏览数 (2)

使用 data-* 属性来嵌入自定义数据: 可以用来传参

代码语言:javascript复制
<td><input data-schoolcode="${item.schoolCode}" data-region="${item.region}" type="button" class="searchbtns search" value="导出号码" onclick="orderExport(this)"></td>



function orderExport(obj){
            var schoolCode = $(obj).data("schoolcode");
            var region = $(obj).data("region");
            window.location.href = "${ctx}/act/campusNumberManage/outCampusNumber?schoolCode=" schoolCode "&region=" region;
        }

参考: http://www.w3school.com.cn/tags/att_global_data.asp

0 人点赞