Jquery Chosen Plugin のページ (およびデモ) は次のとおりです。とても便利です。
http://harvesthq.github.io/chosen/
私の問題は、2段階の入力フォームを使用して位置情報を収集していることです。最初の選択メニューは国向けです。国が選択されると、2 番目の入力フィールドには、フィールド 1 の国のオプションのみが表示されます。
ここに私の問題のライブデモがあります。
ajax 呼び出しは機能しますが、2 番目のフィールドが返されると、スタイリングが失われます。=(
プラグインによると
選択メニューは特定の html フレーム内にある必要があります
<select data-placeholder="Select City" class="chzn-select" style="width:350px;" tabindex="2" name="city">
<? while($row=mysql_fetch_array($result)) { ?>
<option class="active-result option"
style="padding: 5px 0px 5px 0px; font-family:arial; font-size:12px;"
><?=$row['city']?></option>
<? } ?>
</select>
これは技術的には機能するはずですが、機能しません。呼び出し後にスタイリングを維持する方法についての手がかりはありますか?
返されるphpページは次のとおりです
<!--//---------------------------------+
// Developed by Roshan Bhattarai |
// http://roshanbh.com.np |
// Contact for custom scripts |
// or implementation help. |
// email-nepaliboy007@yahoo.com |
//---------------------------------+-->
<?
#### Roshan's Ajax dropdown code with php
#### Copyright reserved to Roshan Bhattarai - nepaliboy007@yahoo.com
#### if you have any problem contact me at http://roshanbh.com.np
#### fell free to visit my blog http://php-ajax-guru.blogspot.com
?>
<? $country = $_GET['country'];
$link = mysql_connect("SNIP");
if (!$link) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db('SNIP');
$query="SELECT city FROM location WHERE country='$country' ORDER BY `city` ASC";
$result=mysql_query($query);
?>
<div class="x">
<br>
<select data-placeholder="Select City" class="chzn-select" style="width:350px;" tabindex="2" name="city">
<? while($row=mysql_fetch_array($result)) { ?>
<option class="active-result option"><?=$row['city']?></option>
<? } ?>
</select>
</div>