Html and Javascript help

by 3 replies
4
Hi i need help with this one something is wrong, somehow it does not connect to javascript/jquery i think.

Untitled Document

Here is the orginal
Edit fiddle - JSFiddle

Here is my code:
Code:
<html>
<head>
<script src="jquery-1.7.2.min.js"></script>
<script src="jquery-ui.js"></script>
<script src="java.js"></script>
<meta charset="utf-8">
<title>Untitled Document</title>
<link href="style.css" rel="stylesheet" type="text/css">

</head>

<body>
<script type="text/javascript">
jQuery(".chair").click(function(){
    jQuery(".avatar").appendTo(jQuery(this));
});
</script>
<div class="room">
<div class="avatar">
</div>
<div style="position:absolute; top:20px; left:50px;" class="chair">
</div>
<div style="position:absolute; top:20px; left:75px;" class="chair">
</div>
<div style="position:absolute; top:40px; left:40px;" class="table">
</div>
<div style="position:absolute; top:70px; left:50px;" class="chair">
</div>
<div style="position:absolute; top:70px; left:75px;" class="chair">
</div>

</div>
</body>
</html>
Thanks
#programming #html #javascript
  • Move your script down just before your closing </body> tag.

    A good way to see this, is to go to your JSFiddle link, and right click inside the frame with your 'table?' and choose view frame source.

    You generally want to put all scripts at the bottom, so everything else is able to fully load. There are some functions you can add to nearly any script that ensure full page load, but that's another question, and more complicated.
    • [1] reply
    • Thanks it works now And i learned something.. have a nice day my friend
  • Glad I could help

Next Topics on Trending Feed