jQuery: Empty Fiddle

With utilities from Daryl Koopersmith's jQuery Conference 2012 talk

by soumya gangamwar

HTML

<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootswatch/2.1.1/cosmo/bootstrap.min.css">
<div id="home-sec">

   
    <div class=""  >
        <div class=" ">
            <div  class="" >
                <div class="head-main">
                    <!--<p class="header">Book Flight Tickets</p>-->
					<form action="" method="post" name="formindex" >
					<label><input type="radio" name="way" id="oneway" checked="checked">One way</label>
					<label><input type="radio" name="way" id="roundtrip">Round Trip</label>
                    <div class="">
                        <div class="">
                            <div class="">
                                <label class="flight-label">From</label>
                                <select class="form-control" name="fromplace" id="fromplace" placeholder="Takeoff">
									<option value="">Select</option>

								</select>
                            </div>
                           
                            <div class="">
                                <label class="flight-label">To</label>
                                <select class="form-control" name="toplace" id="toplace" placeholder="Landing">
									<option value="">Select</option>
										<option value="">
										  
								
								</select>
                            </div>
                            <div class="">
                                <label class="flight-label">Departure Date</label>
                                <input type="date" name="departdate" id="departdate" class="form-control">
                            </div>
                            <div class="">
                                <label class="flight-label">Return Date</label>
                                <input type="date" class="form-control" name="returndate"  disabled="disabled" id="returndate">
                            </div>
                            <div class="">
                                <label...

JavaScript

$(document).ready(function(){
    //Load City by State
	
	   
	$('#roundtrip').click(function()
		{
			$('#returndate').removeAttr("disabled");
		});

	$('#oneway').click(function()
		{
			$('#returndate').attr("disabled","disabled");
		});
	
	$('.dropdown-menu input').click(function (e) {
			e.stopPropagation();
	});
	//$('.dropdown-menu li').click(function(){
		//$("#nopassanger").val(a)

		//	$('.dropdown-toggle b').remove().appendTo($('.dropdown-toggle').text($(this).text()));
	//});
	
	 $(".dropdown-menu").on('click', 'li a', function(){
      $(".btn:first-child").text($(this).text());
      $(".btn:first-child").val($(this).text());
   });
	
	
	$('.seatclass').click(function() {
		//	$('.dropdown-toggle b').remove().appendTo($('.dropdown-toggle').text($(this).text()));
	});
	
	
	
	$('#adds').click(function add() {
			var $rooms = $("#noadults");
			var a = $rooms.val();

			a++;
			$("#subs").prop("disabled", !a);
			$rooms.val(a);
			// $(#nopassanger).val(a)
	});
	$("#subs").prop("disabled", !$("#noadults").val());

	$('#subs').click(function subst() {
			var $rooms = $("#noadults");
			var b = $rooms.val();
			if (b >= 1) {
				b--;
				$rooms.val(b);
			}
				else {
				$("#subs").prop("disabled", true);
			}
	});
	
	
	
	$('#addchildren').click(function add() {
			var $rooms = $("#nochilds");
			var a = $rooms.val();

			a++;
			$("#subchildren").prop("disabled", !a);
			$rooms.val(a);
			// $(#nopassanger).val(a)
	});
	$("#subchildren").prop("disabled", !$("#nochilds").val());

	$('#subchildren').click(function subst() {
			var $rooms = $("#nochilds");
			var b = $rooms.val();
			if (b >= 1) {
				b--;
				$rooms.val(b);
			}
				else {
				$("#subchildren").prop("disabled", true);
			}
	});

	 })