I'm using the following script to disable "cut and paste" on my form:
$(document).ready(function(){
$('.employeeEmailConfirm, .emailConfirm').bind("cut copy paste",function(e) {
alert('thou. shalt. not. PASTE!');
e.preventDefault();
});
});
Taken from the following thread: How to disable Paste (Ctrl+V) with jQuery?
But I don't want to display the "alert" I want to display hidden div's.
However, my form has radio button list and some form elements are shown or hidden depending on which value is selected:
$(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);
}
});
How do I combine the "cut copy paste" script with my show/hide radio button list?
My failed attempt:
$(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();
});
});