1

I'm busy writing a webpage and I came into a couple problems using jQuery.

I needed to load the content into a div and that is going according to plan, but the problem now is that I want the index page to auto load the home.HTML into that div so I don't have to change to HTML files when I want to change content on the home page. but I don't know how to do that.

second problem I have with jQuery is the fact that using jQuery removes the active link hand cursor and replaces it with a test cursor if you hang over the link instead of creating an active link hand

does anybody know how to resolve these problems?

this is how I do the links:

<tr>
  <td><a onclick='$("#rightPan").load("content/zwangerschap.html");' title="Info">Zwangerschapsmassage</a></td>
  <td>60 Minuten</td>
  <td>€ 37,50</td>
</tr>

thanks for the help in advance!

Ron
  • 394
  • 1
  • 12
  • 24
FGOD
  • 103
  • 2
  • 10

1 Answers1

0

To auto-load your div, put your function in a document.ready wrapper:

<script>
    $(function() { // shorthand for `$(document).ready(function() {
        $("#rightPan").load("content/zwangerschap.html");
    });
</script>

You could skip that and just run the statement if you include the script after the HTML that it acts on, like right before the closing body tag:

    <script>
        $("#rightPan").load("content/zwangerschap.html");
    </script>
</body>

jQuery isn't changing your cursor. The fact that you don't have a (required) href attribute does that. http://jsfiddle.net/isherwood/jT8Uq

isherwood
  • 58,414
  • 16
  • 114
  • 157
  • thanks a lot! that worked like a charme! stupid i forgot the href attribute though... now i only have to change to settings for the active links to the same a as my tekst and then i'm done :) – FGOD Apr 16 '14 at 13:35
  • maybe stupid question, but why doesn't my link addept to the stylesheet? is it because of the jQuery? – FGOD Apr 16 '14 at 13:48
  • You'll have to be more specific. jQuery doesn't change styles unless you direct it to do so. – isherwood Apr 16 '14 at 14:35
  • sorry for the late response, had a bit of a busy time lately so no time to work at the webpage untill today, but i figured out the problem right after i posted this, so i found the solution to the style problem myself luckily :) thanks anyway :) – FGOD Apr 23 '14 at 18:59