动态选择框来填充使用AJAX或jQuery和PHP中的文本框 [英] Dynamic select box to populate a textfield using AJAX or jQuery and PHP

查看:324
本文介绍了动态选择框来填充使用AJAX或jQuery和PHP中的文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何教程或code,有助于从一个选择框usuig AJAX或jQuery和PHP poulate在所选的值一个文本框?像中的图片...

解决方案

 <脚本SRC =htt​​p://ajax.googleapis.com/ajax/libs/jquery/1.4。 2 / jquery.min.js>< / SCRIPT>
<脚本>
  //请访问http://www.nokiflores.com
$(文件)。就绪(函数(){
   $(#国)。改变(
       功能 () {
           $(#资本)VAL($(本).VAL());
       }
   );
});
< / SCRIPT>
<选择ID =国家名称=国家>
  <期权价值=德里>印度和LT; /选项>
  <期权价值=马尼拉>菲尔< /选项>
  <期权价值=东京>日本< /选项>
< /选择>

<输入类型=文本只读=只读值=ID =资本NAME =资本/>
 

试试这个: 如果你想使用PHP,你会用ajax做的另一种方式。 请访问 http://www.nokiflores.com

Is there any tutorial or code that help to poulate a textfield from a chosen value from a select box usuig AJAX or jQuery and PHP? Like in the picture ...

解决方案

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script>
  //Please visit http://www.nokiflores.com
$(document).ready(function () {
   $("#country").change(
       function () {
           $("#capital").val($(this).val());
       }
   );
});
</script>
<select id="country" name="country">
  <option value="Delhi" >India</option>
  <option value="manila" >phil</option>
  <option value="tokyo" >japan</option>
</select>

<input type="text" readonly="readonly" value="" id="capital" name="capital" />

try this one: if you want to use php you will do it another way using ajax. Please visit http://www.nokiflores.com

这篇关于动态选择框来填充使用AJAX或jQuery和PHP中的文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆