jquery - Not able to extract values from Bootstrap dropdown to my calculation -


I am currently trying to bootstrap my dropdown style and I have a small calculation based on two selected values I want to point out the bottom line. Actually, you are going to select the number of people going towards the boat. All the boats have fixed the price, so the more you are on a boat, the more cheap it is for every person. But different boats are available for different people; The number of people is divided into three groups; 5-7, 8-9 and 10-11 people

Here are my two dropdowns:

  & lt; Id = "people who choose" class = "selector" data-style = "btn-primary" data-width = "100%" title = "walge end" & gt; & Lt; Option value = "5" & gt; 5 people & lt; / Options & gt; & Lt; Option value = "6" & gt; 6 people & lt; / Options & gt; & Lt; Option value = "7" data-subtext = "(deceased proven)" & gt; 7 people & lt; / Options & gt; & Lt; Option value = "8" & gt; 8 people & lt; / Options & gt; & Lt; Option value = "9" data-subtext = "(Mary Price)" & gt; 9 people & lt; / Options & gt; & Lt; Option value = "10" & gt; 10 people & lt; / Options & gt; & Lt; Option value = "11" data-subtext = "(deceased proven)" & gt; 11 people & lt; / Options & gt; & Lt; / Select & gt; & Lt; Select ID = "pickboat" class = "selector" data-style = "btn-primary" data-width = "100%" data-header = "bug watt" & gt; & Lt; Option value = "oceanis40" data-value = "8999" & gt; Oceania 40 & lt; / Options & gt; & Lt; Option value = "Bavaria" data-value = "869 9" & gt; Bavaria 38 & lt; / Options & gt; & Lt; Option value = "hanse370" data-value = "879 9" & gt; Swan 370 & lt; / Options & gt; & Lt; Option value = "Sunrise 4242" data-value = "9 6 9" & gt; Sun Odyssey 42 & lt; / Options & gt; & Lt; / Select & gt;  

So I want to remove the number of people from the first dropdown and multiply that value with the value from the boat (defined in the data-price attribute of the 2 dropdown) and copy at that number According to the group (7, 9 or 11) divided by the maximum number of persons.

  var pickboat; People who choose Var = $ ('# takers'). Val (); Var boatprice = $ ('# pickboat'). Data ('price'); If (raised people === 5] sections taken === 6] people caught === 7) {pickboat = "7"; } And if (Selected people === 8] Options taken === 9) {pickboat = "9"; } And if (Selected people === 10 || Purchasers === 11) {pickboat = "11"; }; Var Prize = (Nahapris * caught) / Pickbot; Console.log (price);  

This is my attempt for a jQuery solution, but I am unable to extract numbers correctly. Tried to look through the bootstrap manual and see if I'm missing anything, but I did not know what to do.

Any ideas?

Thank you!

Here's my attempt in the solution ->

  Var pickboat; Var pickpersons = parseInt ($ ('# pickpersons'). Val ()); Var boatprice = $ ('# pickboat option: selected'). Data ('value'); Warning (pickedpersons); Warning (boatprice); If (raised people === 5] sections taken === 6] people caught === 7) {pickboat = "7"; } And if (Selected people === 8] Options taken === 9) {pickboat = "9"; } And if (Selected people === 10 || Purchasers === 11) {pickboat = "11"; }; Var Prize = (Nahapris * caught) / Pickbot; Warning (price);  

Comments