Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery how to on element click hide only li assosiated with the element not others
    primarykey
    data
    text
    <p>I am having some problems. Basically I am adding images which are loaded via the load function in jQuery into the page via a file called notice.php </p> <p>This file will display photos and such. The problem I am facing is this: For the photos I will be adding thickbox support which I can do using rel tag. However, I want to give my users the ability to delete these photos by clicking the icon that will show up. Here is the structure:</p> <pre><code>e &lt;ul class="imglist"&gt; &lt;li&gt; &lt;img src="http://localhost/fileserver/3/2lV2H075.jpg" width="308" height="auto" alt="Image1" /&gt; &lt;div class="actions"&gt; &lt;a href="#" class="imglistbutton"&gt; &lt;img src="http://localhost/fileserver/1/j5357n7X.png" width="16" height="16" alt="Delete" /&gt; &lt;/a&gt; &lt;/div&gt; &lt;/li&gt; &lt;br/&gt; &lt;li&gt; &lt;img src="http://localhost/fileserver/3/2lV2H075.jpg" width="308" height="auto" alt="Image2" /&gt; &lt;div class="actions"&gt; &lt;a href="#" class="imglistbutton"&gt; &lt;img src="http://localhost/fileserver/1/j5357n7X.png" width="16" height="16" alt="Delete" /&gt; &lt;/a&gt; &lt;/div&gt; &lt;/li&gt; &lt;br/&gt; &lt;/ul&gt; </code></pre> <p>So when the user clicks on</p> <blockquote> <p> &lt;#img src="http://localhost/fileserver/1/j5357n7X.png" width="16" height="16" alt="Delete" /> </p> </blockquote> <p>the jQuery code will close the specific LI tag which this element was clicked in.</p> <p>Here is the code that I failed at:</p> <pre><code> &lt;script type="text/javascript"&gt; $(document).ready(function() { $(".imglistbutton").live("click", function() { $(this).hide(); var imgHide = $(this).attr("li") $("img").hide(); $(imgHide).hide(); }); }); &lt;/script&gt; </code></pre> <p>And my last question is this:</p> <p>Basically I have a file called main.html. When a user clicks anything in the navigation, it loads a page via the jQuery load command into a specified div id element.</p> <p>So say I click "Dashboard". PHP will load dashboard.php, but I need to load more items into dashboard.php via AJAX.</p> <p>I tried putting code in the main.html so it would read the div elements in dashboard.php and load other files the same way as it loaded dashboard.php via jQuery load, but this does not seem to work. I need to use the following code in every other file then main.html to load stuff via AJAX:</p> <pre><code> &lt;script type="text/javascript"&gt; $(function() { var href = "notice.php"; $("#dashboard_notice_utm").load(href); }); &lt;/script&gt; </code></pre> <p>So this code would be in dashboard.php to load the notice.php file. Would there be an easier way to do this and not have to include stuff in the pages, but rather use one JS file instead? The same goes for my first question since it needs the code to be on notice.php to close the images. </p> <ul> <li>Thank you in advance and sorry for such a long question.</li> </ul>
    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.
 

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