0
我有选择框,它具有价值和client example选择选项错误,但在客户端上运行
和我有服务器端的代码如下
<select name="customer_id" id="customer_id">
<?php get_customer_list_options(); ?>
</select> |
<input id="customer_name_from_sel" type="text" />
及以下的jQuery代码
<script type="text/javascript">
$(document).ready(function(){
$("#customer_id").bind('change', function() {
var k = $("#customer_id option:selected").attr("title");
$("#customer_name_from_sel").val(k);
});
});
</script>
和功能码
function get_customer_list_options() {
$fquery39 = mysql_query("select User_ID, First_Name, Email_ID from customers");
while($r39 = mysql_fetch_row($fquery39)) {
echo "<option value='$r39[0]' title='$r39[1]' >$r39[2]</option>";
}
}
现在,当我从jsfiddle运行代码时,完美运行,而在服务器页面上,它不工作。 而我已经工作的jQuery库很好..在完美的状态。
值ATTR title
不显示在文本customer_name_from_sel
下面是HTML代码图像输出。
错误图像
什么不起作用?你有什么错误吗?你有没有检查你的错误日志?你打开php错误报告? – dm03514 2012-04-23 15:16:18
是的! php和mysql错误是'开'。 attr'title'的值不会显示在文本'customer_name_from_sel'上 – Rafee 2012-04-23 15:18:04
您是否认真为每个结果使用不同的变量名称? – ThiefMaster 2012-04-23 15:18:38