- 7
Trying to achieve exact gainer and lesser like attached image in jQuery
- 7

Actually I’m trying to achieve the exact functionalities used in the site https://www.booking.com
Anyone can help me how to make it.
- Report
Welcome to a real coding world. Developer Helpline is an open community for anybody that codes. We assist you get answers to your hardest coding questions, share information along with your associates.
Login to join a coding world. Developer Helpline is an open community for anybody that codes. We assist you get answers to your hardest coding questions, share information along with your associates.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this answer should be reported.
Abhishek Kumar
Add this HTML element
For the gainer and lesser element
For appended child fields
Add this jQuery script
$(document).ready(function() { var currentRoomCount = 1; var currentAdultCount = 1; var currentchildCount = 0; $("#roomp").on('click', function(e) { e.preventDefault(); if (currentRoomCount & amp; gt; = 1) { currentRoomCount = currentRoomCount + 1; $("#room").html(currentRoomCount); $("input[name='room']").val(currentRoomCount); if (currentAdultCount & amp; lt; = currentRoomCount) { currentAdultCount = currentRoomCount; $("#number").html(currentAdultCount); $("input[name='adult']").val(currentAdultCount); } } }); $("#roomm").on('click', function(e) { e.preventDefault(); if (currentRoomCount != 1) { currentRoomCount = currentRoomCount - 1; $("#room").html(currentRoomCount); $("input[name='room']").val(currentRoomCount); } }); $("#plus").on('click', function(e) { e.preventDefault(); if (currentAdultCount & amp; gt; = 0) { currentAdultCount = currentAdultCount + 1; $("#number").html(currentAdultCount); $("input[name='adult']").val(currentAdultCount); } }); $("#minus").on('click', function(e) { e.preventDefault(); if (currentAdultCount != 0) { currentAdultCount = currentAdultCount - 1; $("#number").html(currentAdultCount); $("input[name='adult']").val(currentAdultCount); } }); $("#chldp").on('click', function(e) { e.preventDefault(); if (currentchildCount & amp; gt; = 0 & amp; amp; & amp; amp; currentchildCount & amp; lt; 10) { currentchildCount = currentchildCount + 1; $("#child").html(currentchildCount); $("input[name='child']").val(currentchildCount); $('#itemshow').prepend('<div id="rm"> <select style=" width: 100%; "> <option value="1 Year Old">1 Year Old</option> <option value="2 Year Old">2 Year Old</option> <option value="3 Year Old">3 Year Old</option> <option value="4 Year Old">4 Year Old</option> </select> </div>'); } }); $("#chldm").on('click', function(e) { e.preventDefault(); if (currentchildCount != 0) { currentchildCount = currentchildCount - 1; $("#child").html(currentchildCount); $("input[name='child']").val(currentchildCount); $('#rm:last').remove(); } }); });