jQuery如何组合";禁用剪切和粘贴脚本";单选按钮列表?
我正在使用以下脚本禁用表单上的“剪切和粘贴”:jQuery如何组合";禁用剪切和粘贴脚本";单选按钮列表?,jquery,Jquery,我正在使用以下脚本禁用表单上的“剪切和粘贴”: $(document).ready(function(){ $('.employeeEmailConfirm, .emailConfirm').bind("cut copy paste",function(e) { alert('thou. shalt. not. PASTE!'); e.preventDefault(); }); }); 取自以下线程: 但我不想显示“警报”,我想显示隐藏的div 但是,“我的表单
$(document).ready(function(){
$('.employeeEmailConfirm, .emailConfirm').bind("cut copy paste",function(e) {
alert('thou. shalt. not. PASTE!');
e.preventDefault();
});
});
取自以下线程:
但我不想显示“警报”,我想显示隐藏的div
但是,“我的表单”有单选按钮列表,根据选择的值显示或隐藏某些表单元素:
$(document).ready(function() {
// attach event to employee radio buttons
$("span.isEmployee").find("input").click(function() {
if ($(this).val() == "1") {
$(".aboutyou").show();
$(".yourdetails").show();
$(".referrer").hide();
$(".security").show();
$(".signup").show();
$("#emailTr").show();
$("#employeeEmailMessage1").show();
$("#employeeEmailMessage2").hide();
$("#employeeEmailRetype").show();
$("#nonemployeeEmail").hide();
$("#nonemployeeEmailRetype").hide();
$("#emailMessageSubBrand").show();
SetEmailEnableDisable(true);
} else {
$(".aboutyou").show();
$(".yourdetails").show();
$(".referrer").show();
$(".security").show();
$(".signup").show();
$("#emailTr").hide();
$("#employeeEmailMessage1").hide();
$("#employeeEmailMessage2").hide();
$("#employeeEmailRetype").hide();
$("#nonemployeeEmail").show();
$("#nonemployeeEmailRetype").show();
$("#emailMessageSubBrand").hide();
SetEmailEnableDisable(false);
}
});
如何将“剪切复制粘贴”脚本与显示/隐藏单选按钮列表相结合
我失败的尝试:
$(document).ready(function(){
$('.employeeEmailConfirm, .emailConfirm').bind("cut copy paste",function(e) {
alert('thou. shalt. not. PASTE!');
$("span.isEmployee").find("input").click(function() {
if ($(this).val() == "1") {
$("#employeeEmailMessage2").show();
} else {
$("#nonemployeeEmailMessage").show();
e.preventDefault();
});
});
我让它工作了:
$(document).ready(function() {
$("span.isEmployee").find("input").click(function() {
if ($(this).val() == "1") {
$('.employeeEmail, .employeeEmailConfirm').bind("cut copy paste", function(e) {
$("#employeeEmailMessage2").show();
e.preventDefault();
});
} else {
$('.email, .emailConfirm').bind("cut copy paste", function(e) {
$("#nonemployeeEmailMessage").show();
e.preventDefault();
});
}
});
});