Error: missing ":" after property id

I just don’t seem to get my head around this problem. as far as i’m concerned the javascript/jquery code should work. Any ideas where i’m going wrong?

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>jQuery</title>
    
<script type="text/javascript"
 src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script type="text/javascript">

$(document).ready({
    $('#sub').click(function(){
        alert('work!!');
    });
});

</script>

</head>
<body>
    <form action="" method="post">
        <p>Name
    <input type="text" name="fname" id="nom"></p>
        <p>Last Name
    <input type="text" name="sname" id="snom"></p>
        
    <input type="submit" name="sub" id="sub">
</body>
</html>

The error i’m getting says “error: missing “:” after property id”

thank you

The way you wrote your code is telling the jQuery method .[B]ready/B your passing an object array to it, the correct code should be a function

$(document).ready(function(){
    $('#sub').click(function(){
        alert('work!!');
    });
});

oh yes so true… works fine now. Thanks I feel so stupid :frowning:

No problem, don’t feel bad bud. Happens to all of us at a point