JSFiddle - React, Tailwind, and code Playground

by Sethu raman

HTML

<div class="form-group boolean optional event_halfday">
    <input name="event[halfday]" type="hidden" value="0" />
     <input class="boolean optional" id="event_halfday" name="event[halfday]" type="checkbox" value="1" />
    <label class="boolean optional checkbox" for="event_halfday">
       Is this a halfday event?</label>
</div>
</div>

JavaScript

var checkbox = $('#event_halfday');
var start = "01-04-2014";
          var end =  "05-04-2014";
          if(start != end) {
              if($('#event_halfday').attr('type') == 'hidden') {}
              else {
                  checkbox.hide();
                  $("label[for='event_halfday']").text("You can't create event where From: is not the same as To: as a halfday.")
              }
          }
          else {
              $("label[for='event_halfday']").text("Is this a halfday event?")
              checkbox.show();
          }