1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | var disabled = $( 'input[type="radio"]:disabled' ); disabled.each( function () { var self = $( this ), field = self, overlay = $( '<div />' ); if (self.parent().is( 'label' )) { field = self.parent(); } overlay.css({ position: 'absolute' , top: field.position().top, left: field.position().left, width: field.outerWidth(), height: field.outerHeight(), zIndex: 10000, backgroundColor: '#ffffff' , opacity: 0 }).click( function () { alert( 'You must log in.' ); }); self.parent().append(overlay); }); |
1 2 3 4 | < label >< input type = "radio" name = "radio" value = "1" disabled>1</ label > < label >< input type = "radio" name = "radio" value = "2" >2</ label > < input type = "radio" name = "radio" value = "3" disabled>3</ label > < input type = "radio" name = "radio" value = "4" >4 </ label > |