[英]How do I convert or query this Jquery data with PHP and MySQL like in a form - select - option example
我試圖像在a中查詢這些數據
<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>
這是我需要查詢的代碼:
<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'>
看一下這個演示並查看源代碼。 可以使jqxDropDownList
復制<select>
標記中的項目並將其用作源文件。
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's 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>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.