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

如何通过 DOM 从记录中隐藏 RESET 按钮?

如何通过 DOM 从记录中隐藏 RESET 按钮?

千万里不及你 2021-12-23 16:49:53
谁能告诉我如何使用 DOM 隐藏 RESET 按钮?我正在尝试使用 beforeLoad 函数制作一个 uservent 脚本,该脚本将从记录中隐藏/删除 RESET 按钮。
查看完整描述

2 回答

?
翻阅古今

TA贡献1780条经验 获得超5个赞

我找到了一个解决方案:


var form = ctx.form;

var field = form.addField({

  id: 'custpage_code',

  type: 'inlinehtml',

  label: 'Code'

});


field.defaultValue = '<script>' +

  'document.getElementById("resetter").style.display = "none";' +

  'document.getElementById("tdbody_resetter").style.display = "none";' +// removed the extra line along the button

  '</script>';


查看完整回答
反对 回复 2021-12-23
?
一只斗牛犬

TA贡献1784条经验 获得超2个赞

另一种选择是 JQuery,它已经预先加载到 NS 中。


var hideFld = context.form.addField({

    id:'custpage_hide_buttons',

    label:'not shown - hidden',

    type: serverWidget.FieldType.INLINEHTML

});


var scr = "";

scr += 'jQuery("#tbl_resetter").hide();';

scr += 'jQuery("#print").hide();';


hideFld.defaultValue = "<script>jQuery(function($){require([], function(){" + scr + ";})})</script>"

你可以用这个隐藏几乎任何元素。只需在页面源中搜索元素 ID:


“重置”按钮的元素通常是一个带有 ID 的表格tbl_resetter。像上面一样轻松添加多个元素。


查看完整回答
反对 回复 2021-12-23
  • 2 回答
  • 0 关注
  • 189 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号