javascript - Anchor Tags With AJAX / jQuery -
i looking way utilize images links new pages within web app.
i using data-file anchor tags maintain user within web app.
<a data-file="salt.html?v=1"><img src="assets/images/template/salt.jpg" width="125" height="125" /> </a>
these tags inside:
<div class="products_content">
my code looks this:
$('.products_content a').on('click', function(){ $('.products_content a').removeclass('selected'); $(this).addclass('selected'); changepage( $(this).attr('data-file') ); });
any ideas? have no thought why isn't working. have similar set navigation , works fine. navigation set follows:
<nav> <a data-file="home.html?v=1">home</a> <a data-file="about.html?v=1">about us</a> <a data-file="services.html?v=1">services</a> <a data-file="products.html?v=1">products</a> </nav>
and:
$('nav a').on('click', function(){ $('nav a').removeclass('selected'); $(this).addclass('selected'); changepage( $(this).attr('data-file') ); }); $('nav a:nth-child(1)').trigger('click');
any help appreciated. in on head.
works me in jsfiddle. errors showing in console? selector finding anchor
s begin with? click event getting fired? changepage()
method beingness included in page somewhere?
javascript jquery ajax anchor hyperlink
No comments:
Post a Comment