Php 编辑一个<;输入>;jQuery中的元素
我想使用jQuery用数据填充元素 不幸的是,元素保持空白。到目前为止,我使用了一种变通方法,并使用了文本区域而不是输入(出于某种原因,输入是有效的) 我不仅尝试了Php 编辑一个<;输入>;jQuery中的元素,php,jquery,Php,Jquery,我想使用jQuery用数据填充元素 不幸的是,元素保持空白。到目前为止,我使用了一种变通方法,并使用了文本区域而不是输入(出于某种原因,输入是有效的) 我不仅尝试了 $('#input').val("Text") ; 而且 $('#input').text("text") ; $('#input').attr("value", "Text") ; 我不理解这种行为,在我的项目之外,它工作得很好。 也许可以忽略这个问题。(请原谅代码混乱) 我还有一个小问题: 我正在使用async:false使
$('#input').val("Text") ;
而且
$('#input').text("text") ;
$('#input').attr("value", "Text") ;
我不理解这种行为,在我的项目之外,它工作得很好。
也许可以忽略这个问题。(请原谅代码混乱)
我还有一个小问题:
我正在使用async:false
使整个过程正常工作,如果我删除它,将不会显示任何内容。但我知道这是不可取的,我有什么选择呢
非常感谢。#input
搜索具有id输入的元素。我没有看到任何关于源代码的信息
要更改单个输入字段的文本,请为其指定唯一的id。如id='sampleText'
然后更改其值,如
$(“#示例文本”).val(“您的文本”)
#input
搜索具有id输入的元素。我没有看到任何关于源代码的信息
要更改单个输入字段的文本,请为其指定唯一的id。如id='sampleText'
然后更改其值,如
$(“#示例文本”).val(“您的文本”)
在HTML中没有ID为input
的元素,我想您要更改input元素的值,请更改以下内容:
$('#input').val("Text") ; // this is an ID selector
到
您的HTML中没有ID为input
的元素
,我想您想更改input元素
的值,请更改以下内容:
$('#input').val("Text") ; // this is an ID selector
到
您的代码有一些错误,请检查
<form id="editForm" method="POST" action="updatedata.php">
**<input type="text" id="editHeading" name="editHeading" /></textarea><br>**
<textarea id="editAuthor" name="editAuthor" /></textarea><br>
<textarea id="editTag" name="editTag" type="text" /></textarea><br>
<textarea id="editarea" name="editarea"></textarea><br>
<input id="id" name="id">
<input id="submitEditForm" name="submitEditForm" type="submit" /><br>
</form>
**
**
您的代码有一些错误,请检查
<form id="editForm" method="POST" action="updatedata.php">
**<input type="text" id="editHeading" name="editHeading" /></textarea><br>**
<textarea id="editAuthor" name="editAuthor" /></textarea><br>
<textarea id="editTag" name="editTag" type="text" /></textarea><br>
<textarea id="editarea" name="editarea"></textarea><br>
<input id="id" name="id">
<input id="submitEditForm" name="submitEditForm" type="submit" /><br>
</form>
**
**
供参考一些一般概念
$('input').val('foo'); //updates with value foo for all input elements
$('#input').val('foo'); //updates with value foo an input element with id #input
$('span#a').val('foo'); //wont work ,here we have to use .html
$('span#a').html('foo'); //<span>foo</span>
$('input').val('foo')//更新所有输入元素的值foo
$('#input').val('foo')//使用值foo更新id为#input的输入元素
$('span#a').val('foo')//不行,这里我们必须使用.html
$('span#a').html('foo')//福
供参考一些一般概念
$('input').val('foo'); //updates with value foo for all input elements
$('#input').val('foo'); //updates with value foo an input element with id #input
$('span#a').val('foo'); //wont work ,here we have to use .html
$('span#a').html('foo'); //<span>foo</span>
$('input').val('foo')//更新所有输入元素的值foo
$('#input').val('foo')//使用值foo更新id为#input的输入元素
$('span#a').val('foo')//不行,这里我们必须使用.html
$('span#a').html('foo')//福
见鬼。。。
我找到了。这并不是说该值没有被插入,而是不可见
我的Chrome在输入中没有显示“test”一词,而jQuery以前将其隐藏
有了FF,一切正常。见鬼。。。
我找到了。这并不是说该值没有被插入,而是不可见
我的Chrome在输入中没有显示“test”一词,而jQuery以前将其隐藏
使用FF,一切正常。有多个输入元素。有多个输入元素。应该说“输入”id只是伪的,对于Showcase,应该说“输入”id只是伪的,对于Showcase,毕竟我用fadeIn
替换了slideDown
解决了问题。这在Chrome和FF中都有正确的显示。因此,毕竟我通过将slideDown
替换为fadeIn
解决了这个问题。这在Chrome和FF中都能正确显示。