Note that there are some explanatory texts on larger screens.

plurals
  1. POJQuery Finding a Div using parents
    primarykey
    data
    text
    <p>I have a table full of checkboxes. Each row is one event and each checkbox is a task that needs to be completed for that event. I want to be able to replace the checkbox with the initials of the User who selected it. I also want to be able to choose the div below the checkbox thats clicked so I can reveal it because it contains my initials. Also Im using Ruby on Rails.</p> <pre><code>&lt;td class='completed_box' id='complete_raw_footage_&lt;%= check_list.id %&gt;'&gt; &lt;%= f.check_box :raw_footage_check, :class =&gt; 'task_check', :id =&gt; 'check_list_raw_footage_check_' + check_list.id.to_s, :category =&gt; 'raw_footage', :check_list_id =&gt; check_list.id, :style =&gt; ("display:none" if check_list.raw_footage_user_id != nil) %&gt; &lt;div class='initials' style="&lt;%= 'display:none;' if check_list.raw_footage_user_id == nil %&gt;"&gt; &lt;div id='raw_footage_&lt;%= check_list.id %&gt;' title='&lt;%= check_list.event.name %&gt;' class='hidden_dialog'&gt; &lt;b&gt;Task Completed:&lt;/b&gt; Raw Footage Recieved &lt;br /&gt; &lt;b&gt;Task Completed By:&lt;/b&gt; &lt;%= check_list.raw_footage_user_id.name rescue current_user.name %&gt;&lt;br /&gt; &lt;b&gt;Task Completed At:&lt;/b&gt; &lt;%= check_list.raw_footage_date.strftime("%F %r") rescue Time.now.strftime("%F %r") %&gt; &lt;/div&gt; &lt;%= check_list.raw_footage_user_id.initials rescue current_user.initials%&gt; &lt;br /&gt; &lt;%= check_list.raw_footage_date.strftime("%-m/%d") rescue Time.now.strftime("%-m/%d") %&gt; &lt;/div&gt; &lt;/td&gt; </code></pre> <p>so when the checkbox with the class 'task_check' is clicked it will find ONLY the next class 'initials' and change the css to display:inline. If you need anymore information please let me know.</p> <pre><code>$('.completed_box').children('.initials').css('display','inline') </code></pre> <p>That is what i used originally but it turns every div w/ the class initials to display:inline.</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.
    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