expiredninja
expiredninja

Reputation: 1407

.load loading content in a box inside the div, rather than just filling the div

essentially i would just like the text of the loaded content. I've been researching jquery functions but can't find the right one. couldn't get $.get() to work. Both the preexisisting div and loaded scrap have an id of "content". jquery:

 $(function() {
        $('#header a').click(function() {
            $('#content').empty();
            $('#content').load(this.href);
            return false;
        });
    });

html:

<div id="header" class="ui-corner-all ui-buttonset">
         <a title="index" href="index.php" ><span>home</span></a>
         <a title="code" href="code.php" ><span>code</span></a>
         <a title="design" href="design.php" ><span>design</span></a>
         <a title="illustration" href="illustration.php" ><span>illustration</span></a>
         <a title="writing" href="writing.php" ><span>writing</span></a>
         <a title="links" href="links.php" ><span>links</span></a>
         <a title="about" href="about.php" ><span>about</span></a>
         </div>

<div id="contentspace" class="body ui-corner-all">
</div>

a loaded page:

<??>
<div id="content">
<title>illustration</title>
<h2>illustration</h2>
</div>
<??>

Upvotes: 0

Views: 143

Answers (1)

Rafay
Rafay

Reputation: 31043

Both the preexisisting div and loaded scrap have an id of "content".

i didnt understand the question well, but you should not have the identical ids

$(function() {
 $('#header a').click(function() {
 $('#content').empty();
  $.get(this.href,function(data){
    $("#content").append($(data).wrap("<div class='box'/>"));
  });
   return false;
 });
});

Upvotes: 1

Related Questions