jq
html
效果
function setTypename(){
var item = $("#typeid").find('option:selected').text();
$(':input[name=typename]').val(item)
}
var item = $("#typeid").find('option:selected').text();
$(':input[name=typename]').val(item)
}
<
select
onchange
="setTypename()"
name
="typeid"
id
="typeid"
class
="valid"
>
<
option
value
="" selected="selected"
>请选择分类
</option>
<
option
value
="1"
>下载工具
</option>
<
option
value
="2"
>系统维护
</option>
<
option
value
="3"
>网络电视
</option>
<
option
value
="4"
>视频播放
</option>
<
option
value
="5"
>MP3 工具
</option>
<
option
value
="6"
>联络聊天
</option>
<
option
value
="7"
>游戏平台
</option>
<
option
value
="8"
>插件/病毒清理
</option>
<
option
value
="9"
>阅读/图像
</option>
<
option
value
="10"
>其 他
</option>
</select>
< input type ="text" style ="width:150px" value ="" name="typename" class ="valid" >
< input type ="text" style ="width:150px" value ="" name="typename" class ="valid" >
![](../p_w_upload/201203/105209803.png)
转载于:https://blog.51cto.com/wuhai/811148