Fiddle: http://jsfiddle.net/ugzux/
As you can see, I have a form with a disabled (via javascript) submit button.
I want to be able to bind a click event to
An other workaround with combination of a required checkbox could be:
U need to check this box
CSS-Magic
#submitButton{
display:inline-block;
color:#D00019;
width:160px;
z-index:30;
position:absolute;
display:block;
top:0;
left:0;
height:30px;
outline:none;
}
#submitButton.nope{
z-index:10;
color:#333;
}
.button_outer {
width:162px;
height:32px;
z-index:50;
position:relative;
}
span.button_overlay{
display:block;
height:30px;
width:162px;
position:absolute;
top:0;
left:0;
background:#fff;
opacity:0.3;
filter: alpha(opacity=30);
z-index:20;
}
.einweilligung_hinweis_error{
color:red;
}
JQuery-Stuff
(document).ready(function() {
$('.einwilligung').click(function() {
var buttonsChecked = $('.einwilligung:checked');
if (buttonsChecked.length) {
$('#submitButton').removeAttr('disabled');
$('#submitButton').removeClass('nope');
$('.einwilligung_hinweis').removeClass('einweilligung_hinweis_error');
}
else {
$('#submitButton').attr('disabled', 'disabled');
$('#submitButton').addClass('nope');
}
});
$('.button_outer').click(function(){
if($('#submitButton').hasClass('nope')){
$('.einwilligung_hinweis').addClass('einweilligung_hinweis_error');
}else{
$('.einwilligung_hinweis').removeClass('einweilligung_hinweis_error');
}
});
});
Maybe not state of the art, but it works pretty well!