I'm trying to find an anchor inside a div that posses a specific attribute, but the jquery code is for some looking at the hreef value of the anchor, not the anchor itself. This is the code I'm using:
<script type="text/javascript">
$(document).ready(function() {
$("#ax_campaign_nav a").each(function (i) {
if (this.attr('data-ident') == "ax_models") {
this.hide();
}
});
});
</script>
And my link looks like this:
<a href="javascript:void(0);" data-ident="ax_models" onclick="scrollToAnchor('#a_ax_models')">+ Model Bios</a>
What am I doing wrong? Thanks for the help.
Try something like this:
$("#ax_campaign_nav a[data-ident=ax_models]").hide();
$(this).attr("data-ident") and $(this).hide()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With