请教用jquery 如何给文本框赋值

WBOY
Release: 2016-06-13 10:11:18
Original
1086 people have browsed it

请问用jquery 怎么给文本框赋值
我有个文本框 根据数据库生成条数。请问我怎么用jquery赋值
$("#num[]").val("10"); 这样赋不了值

------解决方案--------------------
生成这样比较好
------解决方案--------------------
你的id就不合法。
------解决方案--------------------
id 必须唯一
------解决方案--------------------
jquery 遍历所有 input 赋值就是了
------解决方案--------------------
$("input[name^='num']").attr("value","ok");
------解决方案--------------------
你想取哪个id. 如果是想为id="num_id"赋值。想下面这样:
$("#num_id").val("10"); 且确认你的jquery文件已导入。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template