need help with Enhance Forms using jQuery UI

need help with Enhance Forms using jQuery UI

I am trying to  enhance my forms look and feel for which I am trying   this   tutorial  .
I tried to copy the code into my html but its now working and there are some errors , is there a working copy which I can download and use  and can I see a demo of this? The links for demo and download dont work.

here is my html

  1. <!DOCTYPE htm
  2. l PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" >
  4. <head>
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  6.     <title>Expand table rows with jQuery - jExpand plugin - JankoAtWarpSpeed demos</title>
  7.     <script type="text/javascript" src="jquery-1.7.min.js"></script>
  8. <link rel="stylesheet" type="text/css" href="jquery-ui.css">
  9. <script type="text/javascript" src="jquery-ui-1.10.3.custom.min.js"></script>
  10. <script>
  11. $.widget("ui.form",{
  12.  _init:function(){
  13. var object = this;
  14. var form = this.element;
  15. var inputs = form.find("input , select ,textarea");

  16.          form.find("fieldset").addClass("ui-widget-content");
  17. form.find("legend").addClass("ui-widget-header ui-corner-all");
  18. form.addClass("ui-widget");

  19. $.each(inputs,function(){
  20. $(this).addClass('ui-state-default ui-corner-all');
  21. $(this).wrap(&lt;label /&gt;");

  22. if($(this).is(":reset ,:submit"))
  23. object.buttons(this);
  24. else if($(this).is(":checkbox"))
  25. object.checkboxes(this);
  26. else if($(this).is("input[type='text']")||$(this).is("textarea")||$(this).is("input[type='password']"))
  27. object.textelements(this);
  28. else if($(this).is(":radio"))
  29. object.radio(this);
  30. else if($(this).is("select"))
  31. object.selector(this);

  32. if($(this).hasClass("date"))
  33.         $(this).datepicker();
  34. });
  35.  var div = jQuery("&amp;lt;div /&gt;",{
  36.   css:{
  37.   width:20,height:20,
  38.   margin:10,textAlign:"center"
  39.   }
  40.   }).addClass("ui-state-default drag");
  41.  var no = Math.ceil(Math.random() * 4);
  42.  var holder = jQuery("&amp;lt;div /&gt;",{
  43.  id:'droppable',
  44.  text:"Drop the box with "+no+" here",
  45.                   css:{
  46. width:100,height:100,float:'right',fontWeight:'bold'}
  47.  }).addClass('ui-state-default');
  48.  $(form).find("fieldset").append(holder);
  49.  for(var i=1;i&amp;lt;5;i++)
  50. {
  51. $(form).find("fieldset").append(div.clone().html(i).attr("id",i));
  52. }

  53. $(".drag").draggable({containment: 'parent'});
  54. $("#droppable").droppable({
  55. accept:'#'+no,
  56. drop: function(event, ui) {
  57. $(this).addClass('ui-state-highlight').html("Right One");
  58. form.find(":submit").removeClass('ui-state-disabled').unbind('click');
  59. }
  60. });
  61. $(".hover").hover(function(){
  62.  $(this).addClass("ui-state-hover");
  63.   },function(){
  64.  $(this).removeClass("ui-state-hover");
  65.   });

  66. },
  67. textelements:function(element){

  68. $(element).bind({

  69.    focusin: function() {
  70.     $(this).toggleClass('ui-state-focus');
  71.   },
  72.   focusout: function() {
  73.      $(this).toggleClass('ui-state-focus');
  74.   }
  75.  });

  76. },
  77. buttons:function(element)
  78. {
  79. if($(element).is(":submit"))
  80. {
  81. $(element).addClass("ui-priority-primary ui-corner-all ui-state-disabled hover");
  82. $(element).bind("click",function(event)
  83.   {
  84.   event.preventDefault();
  85.   });
  86. }
  87. else if($(element).is(":reset"))
  88. $(element).addClass("ui-priority-secondary ui-corner-all hover");
  89. $(element).bind('mousedown mouseup', function() {
  90.     $(this).toggleClass('ui-state-active');
  91.   }

  92.  );
  93. },
  94. checkboxes:function(element){
  95. $(element).parent("label").after("&amp;lt;span /&gt;");
  96. var parent =  $(element).parent("label").next();
  97. $(element).addClass("ui-helper-hidden");
  98. parent.css({width:16,height:16,display:"block"});
  99. parent.wrap("&amp;lt;span class='ui-state-default ui-corner-all' style='display:inline-block;width:16px;height:16px;margin-right:5px;'/&gt;");
  100. parent.parent().addClass('hover');
  101. parent.parent("span").click(function(event){
  102. $(this).toggleClass("ui-state-active");
  103. parent.toggleClass("ui-icon ui-icon-check");
  104. $(element).click();

  105. });

  106. },
  107. radio:function(element){
  108.        $(element).parent("label").after("&lt;span /&gt;");
  109. var parent =  $(element).parent("label").next();
  110. $(element).addClass("ui-helper-hidden");
  111. parent.addClass("ui-icon ui-icon-radio-off");
  112. parent.wrap("&amp;lt;span class='ui-state-default ui-corner-all' style='display:inline-block;width:16px;height:16px;margin-right:5px;'/&gt;");
  113. parent.parent().addClass('hover');
  114. parent.parent("span").click(function(event){
  115. $(this).toggleClass("ui-state-active");
  116. parent.toggleClass("ui-icon-radio-off ui-icon-bullet");
  117. $(element).click();
  118. });
  119. },
  120.  selector:function(element){
  121. var parent = $(element).parent();
  122. parent.css({"display":"block",width:140,height:21}).addClass("ui-state-default ui-corner-all");
  123. $(element).addClass("ui-helper-hidden");
  124. parent.append("&amp;lt;span id='labeltext' style='float:left;'&gt;&amp;lt;/span&gt;&amp;lt;span style='float:right;display:inline-block' class='ui-icon ui-icon-triangle-1-s' &gt;&amp;lt;/span&gt;");
  125. parent.after("&amp;lt;ul class=' ui-helper-reset ui-widget-content ui-helper-hidden' style='position:absolute;z-index:50;width:140px;' &gt;&amp;lt;/ul&gt;");
  126. $.each($(element).find("option"),function(){
  127.  $(parent).next("ul").append("&amp;lt;li class='hover'&gt;"+$(this).html()+"&amp;lt;/li&gt;");
  128.   });
  129. $(parent).next("ul").find("li").click(function(){ $("#labeltext").html($(this).html());
  130. $(element).val($(this).html());
  131. });
  132. $(parent).click(function(event){ $(this).next().slideToggle('fast');
  133. event.preventDefault();
  134. });

  135. }

  136. });

  137. </script>
  138. <script>
  139. $(document).ready(function(){
  140. $("form").form();

  141. });
  142. </script>
  143. </head>
  144. <body>
  145.    <form>
  146. <fieldset>
  147.     <legend >Recommendation Code Details  <span>(-)</span> </legend>
  148. <div class="content">
  149. <div>Field1: <input type="text" class="datepicker hasDatepicker"></div>
  150. <div>Field2: <input type="text"></div>
  151. <div>Field3: <input type="text"></div>
  152. <div>Field4: <input type="text"></div>
  153. Select  <input  type="checkbox" idname="isArraFinding"/>
  154. Radio    <input type="radio"/>
  155. </div>
  156. <div id="buttons">
  157.   <input type="button" value="Process" id="process">
  158. <input type="button" value="Cancel" id="cancel">
  159. <input type="submit" value="Submit" id="cancel">
  160. </div>    
  161. </fieldset>
  162. </form>
  163. </body>
  164. </html>

  1. chrome cosnole
  1. $(this).wrap(&lt;label /&gt;");
Uncaught SyntaxError: Unexpected identifier