jQuery show href links problem -
new this, sorry if it's silly. problem follows. have been given list of anchors, html , pdf. these grouped div #anchors hidden on document ready. 2 buttons choice show either html links or pdf links , href$ selector must used. can't show. code follows:
$(document).ready(function(){ alert("anchors hidden"); $('#anchors').hide(); }); $(document).ready(function(){ $('#htmllinks').click(function(event){ alert("html pressed"); $("a[href$=html]").show(); }); });
the alert shows, none of links listed. i've tried loads of things. doing wrong? i've tried $('#anchor a[href$=".html"]').show();
, various other things different combinations of quotation marks, i've tried creating new div , outputting that, i'm getting nowhere. can whole div display, not selection of it. appreciated.
many thanks.
you're hiding whole div here:
$('#anchors').hide();
instead, hide anchors inside...the ones want show, this:
$('#anchors a').hide();
if .show()
child still in hidden parent you'll no effect, you're seeing. instead .show()
on hidden element directly, , leave parent visible.
Comments
Post a Comment