Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to select the <tr> that contains an input with attribute placeholder that's inside either named div
    primarykey
    data
    text
    <p>This may be really simple but I'm not all that familiar with jQuery selectors.</p> <p>Here's the HTML with inline css:</p> <pre><code>&lt;div id="login" style="position:relative; display:none; top:0px; left:0px; right:0px; bottom:0px; text-align:center; vertical-align:middle; z-index:10;" class="trwhole"&gt; &lt;table width="100%" height="100%"&gt; &lt;tr width="100%" height="100%"&gt; &lt;td width="100%" height="100%" style="vertical-align:middle; text-align:center;"&gt; &lt;img src="images/MemorizeItWhite.png" z-index="10000" style="width:290px;"&gt; &lt;table align="center" class="w290"&gt; &lt;tr&gt; &lt;td&gt; &lt;div id="lerror" class="alert"&gt;&lt;/div&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td align="left"&gt;Username: &lt;br&gt; &lt;input autocorrect="off" autocapitalize="off" type="text" placeholder="username" id="username" style="" class="ui-corner-all w290"&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td align="left"&gt;Password: &lt;br&gt; &lt;input type="password" placeholder="password" id="password" style="" class="ui-corner-all w290" onkeypress="if (event.keyCode==13){login();}"&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &lt;input type="button" id="loginBt" onclick="login();" value="Log In" class="submit" style="width:85px;"&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/div&gt; </code></pre> <p>I'm looking for something like </p> <pre><code>$("select tr that contains input[placeholder] in #login or #signup2") .on("touchstart", function () { $("this &gt; input").focus(); }); </code></pre> <p>The point is to give each an <code>ontouchstart</code> attribute changing focus to the input within it, if that input has a placeholder and is in either named div.</p> <p>I could of course just add in the <code>ontouchstart</code> attribute to each tr manually, but then I wouldn't learn anything new, and I'm thinking this can be done with less code with jQuery.</p>
    singulars
    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.
    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