我发誓我之前在我的页面上包含了 jQuery 一百万次,但由于某种原因这不起作用。就好像什么都没有发生一样。
我已经包含了一个指向 jQuery.com 托管版本的外部链接。
有什么见解吗?
<html>
<head>
    <meta charset="utf-8" />
    <link rel="stylesheet" href="http://code.jquery.com/ui/1.9.0/themes/base/jquery-ui.css" />
    <script src="http://code.jquery.com/jquery-1.8.2.js" />
    <script src="http://code.jquery.com/ui/1.9.0/jquery-ui.js" />
    <script>
    $(function() {
    $( "#draggable3" ).draggable({ containment: "#containment-wrapper", scroll: false });
    $("input[type=submit], a, button")
        .button()
        .click(function( event )
        {
            event.preventDefault();
            $("#infobar").append('<p>Full name = ' + $("#first").val() + ' ' +  $("#last").val() + '  </p>');  
            alert("Name added!");                 
        });
       $.getJSON('friends.json', function(data)
       {
            $.each(data, function()
            {
                $.each(this, function(k, v)
                {
                  $("#infobar").append('<p>' + v.firstName + ' '  + v.lastName + '</p>');
               });
            });     
       });
});
    </script>
    <style>
    .draggable { width: 50px; height: 50px; padding: 0.5em; float: left; margin: 0 10px 10px 0; }
#draggable, #draggable2 { margin-bottom:20px; }
#draggable { cursor: n-resize; }
#draggable2 { cursor: e-resize; }
#containment-wrapper { width: 95%; height:150px; border:2px solid #D00000 ; padding: 10px; border-style:dashed;}
#infobar {background: #E8E8E8; width:100%}
</style>
</head>
<body>
<div id="containment-wrapper">
    First Name: <input type="text" name="firstname" id="first"><br>
    Last name: <input type="text" name="lastname" id="last">
    <input type="submit" value="Calclulate" />
    <div id="draggable3" class="draggable ui-widget-content">
        <p>LET ME OUT!</p>
</div>
</div>
<div id="infobar">
  </div>
</body>
</html>