javascript - jquery dialog gives missing : after property id error -


i trying popup jquery dialogue box here. when dialog has following code..

var opt = {         autoopen: false,         modal: true,         width: 550,         height:650,         title: 'details' }; 

it works fine. popup window. adding additional info getting me error.

updated post

 <script> $(document).ready(function(){   $(".editbt").click(function(event) {     event.preventdefault();       $.ajax({         type: "get",         url: this.href,         cache:false,         success: function(response){         var opt = {          box :$( "#box" ),       itemname:$( "#itemname" ),       size:$( "#size" ),       potency:$( "#potency" ),       quantity:$( "#quantity" ),        allfields:$( [] ).add( box ).add(itemname).add(size).add(potency).add(quantity),       tips :$( ".validatetips" );      function updatetips( t ) {       tips         .text( t )         .addclass( "ui-state-highlight" );       settimeout(function() {         tips.removeclass( "ui-state-highlight", 1500 );       }, 500 );     }     function checklength( o, n, min, max ) {       if ( o.val().length > max || o.val().length < min ) {         o.addclass( "ui-state-error" );         updatetips( "please enter field " );         return false;       } else {         return true;       }     }     function checkregexp( o, regexp, n ) {       if ( !( regexp.test( o.val() ) ) ) {         o.addclass( "ui-state-error" );         updatetips( n );         return false;       } else {         return true;       }     }      $( "#dialog-form" ).dialog({       autoopen: false,       height: 600,       width: 500,       modal: true,       buttons: {         "edit": function() {           var bvalid = true;           allfields.removeclass( "ui-state-error" );  bvalid = bvalid && checklength( box, "box", 1, 16 );   bvalid = bvalid && checklength( itemname, "itemname", 1, 16 );            bvalid = bvalid && checklength( size, "size", 1, 16 );         bvalid = bvalid && checklength( potency, "potency", 1, 16 );     bvalid = bvalid && checklength( quantity, "quantity", 1, 16 );                    if ( bvalid ) {             $( "#users tbody" ).append( "<tr>" +               "<td>" + box.val() + "</td>" +               "<td>" + itemname.val() + "</td>" +               "<td>" + size.val() + "</td>" +               "<td>" + potency.val() + "</td>" +               "<td>" + quantity.val() + "</td>" +             "</tr>" );             $( ).dialog( "close" );           }         },         cancel: function() {           $( ).dialog( "close" );         }       },       close: function() {         allfields.val( "" ).removeclass( "ui-state-error" );       }     }); };              if (response.length > 0) {               var wrapperelement = document.getelementbyid('display');                  wrapperelement.innerhtml = response;                  $("#dialog-form").dialog(opt).dialog("open");              }         }  });  });     });  </script> 

any idea?? thank time..

your syntax wrong. creating javascript object, syntax is:

var opt = {     box: $( "#box" ),     itemname: $( "#itemname" ),     size: $( "#size" ),     potency: $( "#potency" ),     quantity: $( "#quantity" ),     .     . } 

also, var ahead of box not needed.

you can as:

var opt = new object(); opt.box = $( "#box" ); opt.itemname: $( "#itemname" ); . . 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -