开发者

jQuery won't work on a page

开发者 https://www.devze.com 2022-12-18 17:28 出处:网络
I have a page that allows users to edit a record from the DB.Simple. The html source looks like this: <form id=\"prize_modify_form\" enctype=\"multipart/form-data\" action=\"\" method=\"POST\" ac

I have a page that allows users to edit a record from the DB. Simple.

The html source looks like this:

<form id="prize_modify_form" enctype="multipart/form-data" action="" method="POST" accept-charset="utf-8"> 
   <p><label for="header">Header</label><input type="text" name="header" value="More Tvs!" id="header"></p> 
   <p><label for="description">Description</label><input type="text" name="description" value="Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmo开发者_Go百科d tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." id="description"></p> 
   <p><label for="short_description">Short Description</label><input type="text" name="short_description" value="Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure d" id="short_description"></p> 
   <p><label for="expiration_date">Expiration Date</label><input type="text" name="expiration_date" value="0000-00-00" id="expiration_date"></p> 
   <p><label for="image">Image</label> 
         <a href="#" id="change_image_link">Change Image</a> 
      <input type="hidden" name="photo" value="png8.png" id="photo"> 
   </p> 
   <p><input type="submit" value="Save"></p> 
</form> 

<link rel="stylesheet" href="../../css/jquery-ui-1.7.2.custom.css" type="text/css" media="screen" title="no title" charset="utf-8"> 
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript" charset="utf-8"></script> 
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js" type="text/javascript" charset="utf-8"></script> 
<script src="../../js/jquery.validate.min.js" type="text/javascript" charset="utf-8"></script> 
<script src="../../js/additional-methods.js" type="text/javascript" charset="utf-8"></script> 
<script type="text/javascript" charset="utf-8"> 
   $(document).ready(function(){
      alert('inside');

    // Set up the validations
    $('#prize_modify_form').validate({
        rules: {
            header: {
                required: true,
                minlength: 2
            },
            description: {
                required: true,
                minlength: 2
            },
            short_description: {
                required: true,
                minlength: 2,
                maxlengh: 250
            }
            image: {
                required: true,
                accept: "jpg|jpeg|gif|png"
            },
            expiration_date: {
                required: true,
                dateITA: true
            }
        }
    });
    // Add the date picker to expiration date
    $('#expiration_date').datepicker();

    // Redirect the page and create a popup for the change image link
    $('#change_image_link').click(function(){
        $id = $('#id').attr('value');
        $prize_id = $("#prize_id").attr('value');

        window.open("image.upload.php?id=" + $id,"Upload Image",
        "menubar=no,width=430,height=100,toolbar=no");
    });
   });
</script>

Inside of my jQuery code, nothing ever gets run. The biggest problem is that this page is pretty much a copy-paste of another page...which works perfectly. I can't quite see where the problem is.


At least 1 problem is the missing comma here:

            maxlengh: 250
        }
        image: {

should be:

            maxlengh: 250
        },
        image: {
0

精彩评论

暂无评论...
验证码 换一张
取 消