www.webdeveloper.com
Results 1 to 2 of 2

Thread: Trouble with link inside div

Hybrid View

  1. #1
    Join Date
    Mar 2012
    Posts
    2

    Trouble with link inside div

    Hey all,

    I'm doing an ajax website. When a link outside of the affected div is clicked on, then the ajax works, but if I click on a link inside the affected div, it doesn't. Please help. My js code's below:

    Code:
    $(function () {
    			if (window.location.hash){contentload(window.location.hash);}
    
    			$('a').click(function() {
    				fragment = this.hash;
    				contentload(fragment);
    			});
    		});
    
    		function contentload(fragment) {
    			fragment = fragment.slice(1).replace('!', '')
    			$('#divname').load('http://www.myurl.com');
    
    		}

  2. #2
    Join Date
    Mar 2012
    Posts
    2

    Please Help anyone!

    To further explain:

    links outside the div work

    <div>

    links inside the div don't
    </div>

    I'm guessing it has to do with:
    Code:
    			$('a').click(function() {
    				fragment = this.hash;
    				contentload(fragment);
    				
    			});
    this.hash doesn't seem to collect the value if the links is in the div.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles