Home >Web Front-end >HTML Tutorial >js中如何把一个获取的变量,放入到文本框中?_html/css_WEB-ITnose

js中如何把一个获取的变量,放入到文本框中?_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-21 08:53:131763browse

function(data){
         if(!data.flag){
                $("#error1").html("该身份证对应账务账号可用")
                var account_id = data.account;
                $("#accountID").html(account_id);    
            }

 //如何把account_id写入到文本中?我上面的做法好像是错误的!


回复讨论(解决方案)

文本框用val()

$("#accountID").val(account_id); 

例如:

<input name="id" type="hidden" id="updateAirHiddenID"/>


设置值得方式如下:
 $('#updateAirHiddenID').attr('value',“123132”);

问题已经解决了就是使用的$("#accountID").val(account_id); 谢了!

Statement:
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