Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6363413
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:02:11+00:00 2026-05-25T00:02:11+00:00

I have a file, say ‘file1.html’, loaded into a div via jQuery $(‘#info’).load(‘info/file1.html’); I

  • 0

I have a file, say ‘file1.html’, loaded into a div via jQuery $('#info').load('info/file1.html'); I want to change the content of #info from within file1 so file1.html looks like this:

<a href="#" onclick="loadFile(this.value);" value="file2">File2</a>

where

function loadFile(f) {
    $('#info').load('info/'+f+'.html');
}

However, I only get a blank page in the div after the click. I also tried removing the 'info/' if the folder setup broke it but nothing. What’s wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T00:02:11+00:00Added an answer on May 25, 2026 at 12:02 am

    The problem is that anchor tag dom objects (HTMLAnchorElement) don’t have a “value” property set on them. To get at the value attribute of the anchor tag that the dom object represents, you can do $(this).attr('value') (instead of this.value, which will just be undefined).

    But really, you should be attaching your event using an id/class and jquery, not by using an onclick attribute. And you should be calling your anchor attribute data-value, not value, to conform to HTML5 specs on custom attributes. So the better way to do this would be:

    HTML:

    <a href="#" id="file-loader" data-value="file2">File2</a>
    

    Javascript:

    $('#file-loader').click(function(ev) {
        $('#info').load('info/' + $(this).attr('data-value') + '.html');
        ev.preventDefault();
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a file lets say c:\file1.txt that has an ADS file lets say
I have a file say /a/b/c/file in my host. I want to create a
I have a file - say readme.txt that I want to copy or insert
Let's say I have file secret_config in .git/info/exclude . My colleague, who doesn't know
Scenario: I have a Long file - Say 30 Minutes. I want to play
I have made one file say a.php. Now I want some thing like if
Static variable has file scope. Say I have two following files: file1.h file1.cpp file2.h
Greetings All; I have a text file say test.txt and I want to make
Say I have a very large file (say > 1GB) and I want to
I have a file say xyz.doc .I want to find the parent /Parents of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.