Note that there are some explanatory texts on larger screens.

plurals
  1. POhtml form input and select not working on touch devices
    primarykey
    data
    text
    <p>I'm trying to build a site that will work on the desktop and with tablets. Obviously touch devices pose some challenges such as button clicks. I've got past that but now the button I click opens up a form. This form contains some select and input types.</p> <p>Click this button:</p> <pre><code>&lt;button class="addwebcam"&gt;Add Webcam&lt;/button&gt; </code></pre> <p>and this opens up a form:</p> <pre><code>&lt;div id="cameraformwebcam" title="Add a webcam"&gt; &lt;form id='AddCameraFormWebcam' action=''&gt; &lt;p&gt; &lt;label for="CameraName"&gt;Camera name: &lt;span class="small"&gt;Enter label for camera&lt;/span&gt; &lt;/label&gt; &lt;input type="text" id="CameraName" name="camera_name" size="24" maxlength="36" /&gt; &lt;/p&gt; &lt;p&gt; &lt;label for='CameraQuality'&gt;Camera quality: &lt;span class="small"&gt;Select camera quality&lt;/span&gt; &lt;/label&gt; &lt;select id='CameraQuality' name='camera_quality'&gt; &lt;option value='HIGH' selected='selected'&gt;High&lt;/option&gt; &lt;option value='MEDIUM'&gt;Medium&lt;/option&gt; &lt;option value='MOBILE'&gt;Mobile&lt;/option&gt; &lt;/select&gt; &lt;/p&gt; &lt;p&gt; &lt;label for='CameraStatus'&gt;Motion detection: &lt;span class="small"&gt;Turn motion detection on/off&lt;/span&gt; &lt;/label&gt; &lt;select id='CameraStatus' name='camera_status'&gt; &lt;option value='ENABLED' selected='selected'&gt;On&lt;/option&gt; &lt;option value='DISABLED'&gt;Off&lt;/option&gt; &lt;/select&gt; &lt;/p&gt; &lt;p&gt; &lt;label for='EmailNotice'&gt;Email notice: &lt;span class="small"&gt;Turn email notices on/off&lt;/span&gt; &lt;/label&gt; &lt;select id='EmailNotice' name='email_notice'&gt; &lt;option value='ENABLED' selected='selected'&gt;On&lt;/option&gt; &lt;option value='DISABLED'&gt;Off&lt;/option&gt; &lt;/select&gt; &lt;/p&gt; &lt;p&gt; &lt;label for='CameraSensitivity'&gt;Camera sensitivity: &lt;span class="small"&gt;Select camera sensitivity&lt;/span&gt; &lt;/label&gt; &lt;select id='CameraSensitivity' name='camera_sensitivity'&gt; &lt;option value='HIGH'&gt;High&lt;/option&gt; &lt;option value='AVERAGE' selected='selected'&gt;Average&lt;/option&gt; &lt;option value='LOW'&gt;Low&lt;/option&gt; &lt;/select&gt; &lt;/p&gt; &lt;input type='hidden' name='camera_type' value='WEBCAM' /&gt; &lt;button type='submit' class='submit_camera' name='addcamera' value='Add'&gt;Add&lt;/button&gt; &lt;button type='reset' class='cancel_changes' name='cancel_changes' value='Cancel'&gt;Cancel&lt;/button&gt; &lt;/form&gt; &lt;/div&gt; </code></pre> <p>My problem is that the form doesn't work when tested on tablets (just fine on desktops). The select types just highlight but do not open to show the selections and the input type for the camera name also just highlights but the keyboard doesn't open.</p> <p>This is handled with jquery:</p> <pre><code>jQuery(".addwebcam").live('touchstart click', function(event){ event.stopPropagation(); touchStart(event); if(event.handled !== true) { jQuery('#cameraformwebcam').show(); jQuery('.addwebcam').hide(); event.handled = true; } else { return false; } }); </code></pre> <p>You will notice the <code>touchStart</code> function. This was a question I found <strong><a href="https://stackoverflow.com/questions/6251150/ipad-ios-html-form-select-does-not-open-on-touch">here</a></strong> to get select to work on touch devices. That doesn't work plus I need all fields to work including the input type.</p> <pre><code>function touchStart(event) { if (event.target.tagName != 'SELECT') { event.preventDefault(); } } </code></pre> <p>My goal here is to keep one site that works for both tablets and desktop sites (mobile devices are different). Especially since it only has a couple of buttons and forms. So I'm trying to avoid using jquery mobile and creating a separate page for tablets.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload