如何将值属性传递给("选项值=" Value_Here")SELECT2插件。我需要google地图中value属性中的数据。它包含我的标记的纬度和经度。
代码:
<select class="distance" id="start">
<?php
include "connect.php";
$sql = "SELECT * FROM tblLocation";
$result = mysqli_query($conn, $sql);
while($row = mysqli_fetch_array($result)){
echo "
<option value='".$row['latitude'].", ".$row['longitude']."'>".$row['branch']."</option>";
}
mysqli_close($conn);
?>
</select>
SELECT2插件的脚本:
$('.distance').select2();