i having problems. adding images loaded via load function in jquery page via file called notice.php
this file display photos , such. problem facing this: photos adding thickbox support can using rel tag. however, want give users ability delete these photos clicking icon show up. here structure:
e <ul class="imglist"> <li> <img src="http://localhost/fileserver/3/2lv2h075.jpg" width="308" height="auto" alt="image1" /> <div class="actions"> <a href="#" class="imglistbutton"> <img src="http://localhost/fileserver/1/j5357n7x.png" width="16" height="16" alt="delete" /> </a> </div> </li> <br/> <li> <img src="http://localhost/fileserver/3/2lv2h075.jpg" width="308" height="auto" alt="image2" /> <div class="actions"> <a href="#" class="imglistbutton"> <img src="http://localhost/fileserver/1/j5357n7x.png" width="16" height="16" alt="delete" /> </a> </div> </li> <br/> </ul>
so when user clicks on
<#img src="http://localhost/fileserver/1/j5357n7x.png" width="16" height="16" alt="delete" />
the jquery code close specific li tag element clicked in.
here code failed at:
<script type="text/javascript"> $(document).ready(function() { $(".imglistbutton").live("click", function() { $(this).hide(); var imghide = $(this).attr("li") $("img").hide(); $(imghide).hide(); }); }); </script>
and last question this:
basically have file called main.html. when user clicks in navigation, loads page via jquery load command specified div id element.
so click "dashboard". php load dashboard.php, need load more items dashboard.php via ajax.
i tried putting code in main.html read div elements in dashboard.php , load other files same way loaded dashboard.php via jquery load, not seem work. need use following code in every other file main.html load stuff via ajax:
<script type="text/javascript"> $(function() { var href = "notice.php"; $("#dashboard_notice_utm").load(href); }); </script>
so code in dashboard.php load notice.php file. there easier way , not have include stuff in pages, rather use 1 js file instead? same goes first question since needs code on notice.php close images.
- thank in advance , sorry such long question.
for first question, don't want use .attr("li")
because li not attribute, ancestor. should instead use .closest so:
$(".imglistbutton").live("click", function() { $(this).closest("li").hide(); }); });
for 2nd question, can use complete parameter of load execute jquery after load operation finishes. this:
$('#result').load('dashboard.php', function() { var href = "notice.php"; $("#dashboard_notice_utm").load(href); });
this way, once dashboard.php loaded, call made load notice.php #dashboar_notice_utm.
Comments
Post a Comment