Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Add this snippet to the script.js file of your theme to fix the fact that you can not click the form item through the label in iOS devices.
/* IPHONE CLICK */
if (navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPod/i) || navigator.userAgent.match(/iPad/i)) {
$('label[for]').click(function () {
var el = $(this).attr('for');
if ($('#' + el + '[type=radio], #' + el + '[type=checkbox]').attr('selected', !$('#' + el).attr('selected'))) {
return;
} else {
$('#' + el)[0].focus();
}
});
}
You will have to add the Drupal specific bits you need for the JQuery to work on load for either D6 or D7.
Comments
Comment #2
bmx269 CreditAttribution: bmx269 commentedNo one else thought this was useful?
Comment #3
drclaw CreditAttribution: drclaw commentedTotally useful. Just used your snippet and it worked like a charm!
Comment #4
bmx269 CreditAttribution: bmx269 commentedThanks for the feedback. I don't have a lot to contribute code wise, so I appreciate the fact that it was useful.
Comment #5
casey CreditAttribution: casey commentedEven easier is adding onclick="" to the <labels> elements. Or even simpler, to the <body> element.