Here's the fiddle: http://jsfiddle.net/PfEVd/
I have the following HTML:
<ul id="timeslots">
<li><button>10:00 AM</button></li>
<li><button>10:30 AM</button></li>
<li><button>11:00 AM</button></li>
<li><button>11:30 AM</button></li>
<li><button>12:00 AM</button></li>
<li><button>12:30 AM</button></li>
<li><button>1:00 PM</button></li>
<li><button>1:30 PM</button></li>
<li><button>2:00 PM</button></li>
<li><button>2:30 PM</button></li>
<li><button>3:00 PM</button></li>
</ul>
<form>
<input type="text" name="appointment_date[start_time]" value="1:00 am" class="time start-time" />
—
<input type="text" name="appointment_date[end_time]" value="1:30 am" class="time end-time" />
</form>
And the following jquery:
$("#timeslots li button").click(function () {
var text = $(this).text();
$("input:text[name='appointment_date[start_time]']").val(text);
});
What I need to figure out is how to simultaneously change the value of "appointment_date[end_time]" to the start time of the next time slot. In other words, if you click the button "10:00 AM" then start_time changes to 10:00 AM and end_time simultaneously changes to 10:30 AM. How would I do this?
Thanks in advance!