jquery-uijquery-ui-button

jquery ui button creating trouble


<table class='dates'>
 <form method='post' action='' name='admin' id='form_admin'>
  <tr>
   <td>Start Time Of Election</td>
   <td>: <input type="text" id="stime" name='elect' placeholder='hh:mm' readonly="true"/></td>
  </tr>
  <tr>
   <td>End Time Of Election</td>
   <td>: <input type="text" id="etime" name='elect' placeholder='hh:mm' readonly="true" disabled='true'/></td>
  </tr>
  <tr>
   <td align='right'>
    <input id='enable' type='submit' name='date' value='Update' disabled='true'/>
   </td>
   <td align='right'>
    <input type='submit' name='cancel' value='Cancel'/>
   </td>
  </tr>
 </form>
</table>

<script type="text/javascript">
$(function(){
 $('#stime').timepicker({
    hourMin: 8,
    hourMax: 10,
    onSelect: function(){
     $('#etime').prop('disabled', false);
     $('#etime').timepicker({
      hourMin: 16,
      hourMax: 18,
      onSelect: function(){
        $('#enable').prop('disabled', false);
     }
    });
   }
  });
});
</script>

my code works fine with jQuery UI, datepicker and time picker and my update button gets enabled up on selecting end time. but when i use jQuery UI button to give a nice look to my buttons, with this code

$(function() {
    $( "input[type=submit], button" )
      .button()
      .click(function( event ) {
      });
});

though i get the styles but my update button never gets enabled.


Solution

  • Try with

    $("#enable").button( "enable" );
    

    See the jQuery doc here