Note that there are some explanatory texts on larger screens.

plurals
  1. POhow can i access td class via jQuery?
    primarykey
    data
    text
    <p>how can i access my td class via jquery here is HTML code</p> <pre><code>&lt;td class="selectable" id="shoes-&lt;?= $color-&gt;id ?&gt;" &gt;&lt;/td&gt; &lt;td&gt;&lt;a href="?shoes=&lt;?php echo $color-&gt;id; ?&gt;" title="Select" &lt;?php if($shoes==$order-&gt;shoes){ ?&gt; class="selected"&lt;?php } ?&gt;&gt; </code></pre> <p>Here is jQuery Code</p> <pre><code>$('td.selectable a').click(function() { var $parent = $(this).parent(); var data = $parent.attr('id').split('-'); var type = data[0]; var typeId = data[1]; </code></pre> <p>if i alert (type); i receive nothing could you help</p> <p>now i got it solved but second part still problem I am trying to switch my class it should show up while clicking on a link here is the html code </p> <pre><code>&lt;td class="selectable" id="person-&lt;?= $person-&gt;id ?&gt;"&gt; &lt;a href="?person=&lt;?php echo $person-&gt;id; ?&gt;" title="Selecteren" if($person==$order-&gt;person){ ?&gt; class="selected"&lt;?php } ?&gt;&gt;&lt;?php echo $person-&gt;name;?&gt;&lt;/a&gt;&lt;/td&gt; </code></pre> <p>it works with span class and div class but with a class=selected does not work</p> <pre><code>$('#personAmount td.selectable a').click(function() { var $parent = $(this).parent() var data = $parent.attr('id').split('-'); var type = data[0]; var typeId = data[1]; switch(type){ case 'person': $(this).prepend('&lt;a class="selected"&gt;&lt;/a&gt;'); break; case 'color': $(this).prepend('&lt;div class="checked"&gt;&lt;/div&gt;'); break; default: $parent.prepend('&lt;span class="checked"&gt;&lt;/span&gt;'); } </code></pre>
    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.
    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