문제

Ok, very very weird issue here. I have a sub nav menu that links to the same page but passes a GET variable through the URL so the little application knows which service to display. The problem I'm having is that no matter which link in the sub menu is clicked, jQuery is returning attributes from the LAST link in the list. I've even tried binding the events to the outer 'li' elements but the same issue occurs! It also occurs no matter which attribute I'm trying to grab.

It wouldn't be an issue except that I'm trying to prevent the links from reloading the page when all the little application needs to do is grab a string from the clicked item to set up the params to run and load the desired data. I guess the easiest way is for me to just link you to a working copy of the page on the web host:

http://www.dealertec.com/_index.html

I currently have it alert out the href attribute so you can see the problem in action.

도움이 되었습니까?

해결책

Error - Line 203 & 204 of services.1.1.js - event is not defined:

li.bind('click touchstart', function() {
event.preventDefault(); 

You need to pass the event in the function in order to prevent the default action:

li.bind('click touchstart', function(e) {
e.preventDefault(); 
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top