How to convert or query Jquery data with PHP and MySQL, as in the form example - select - option

I am trying to request this data, as in

<form name="" action="test" method="post" <select name="people"> <option value="1">1 Person</option> <option value="2">2 People</option> <option value="3">3 People</option> <option value="4">4 People</option> <option value="5">5 People</option> <option value="6">6 People</option> </select> </form> 

This is the code I need to request:

 <div id='content'> <script type="text/javascript"> $(document).ready(function () { var source = [ "Select Your location", "North London", "South London", "West London", "East London", "City of London", ]; // Create a jqxDropDownList $("#jqxDropDownList").jqxDropDownList({ source: source, selectedIndex: 0, width: '250px', height: '35px', theme: 'summer' }); }); </script> <div id='jqxDropDownList'> 
+4
source share
1 answer

Watch this demo and view the source. You can make jqxDropDownList copy the elements from the <select> and use it as a source.

Javascript

 // grab all the original options var select_options = $('#people option'); // hide the original select box $('#people').hide(); // Create a jqxDropDownList $("#jqxDropDownList").jqxDropDownList({ width: '200px', height: '25px' }); // Load the data from the Select html element. $("#jqxDropDownList").jqxDropDownList('loadFromSelect', 'people'); // updates the select selection. $("#jqxDropDownList").bind('select', function (event) { if (event.args) { var args = event.args; // select the item in the 'select' tag. var index = args.item.index; select_options[index].attr("selected", "true"); } }); // selects the first item. $("#jqxDropDownList").jqxDropDownList('selectedIndex', '0'); 

HTML

 <form method="post" action=""> <label for="people">Number of People</label> <select name="people" id="people"> <option value="1">1 Person</option> <option value="2">2 People</option> <option value="3">3 People</option> <option value="4">4 People</option> <option value="5">5 People</option> <option value="6">6 People</option> </select> <div id="jqxDropDownList"></div> </form> 
+1
source

Source: https://habr.com/ru/post/1439341/


All Articles