追加到文本输入
我希望把这段文字输入不是段落标记p
我尝试,但我不能让它追加到文本输入
我追加码
$(req.responseText).find('GetRecipeDetailResponse').each(function(){//Get the servings/yield
var yield = $(this).find('Yield').text();
$('#Yield').append('<p><h6>Servings: ' + yield + " servings"+ '</h6></p>')
$('#Yield').fieldcontain('refresh')
});
HTML代码:
<div data-role="fieldcontain" id="Yield"><!--Yield-->
</div>
我认为你需要使用一个有效的选择,$(this).find('Yield')
也许应该是$(this).find('#Yield')
,如果你想让它在输入(不知道我理解你的问题,但我认为这是你想要的):
$('#Yield').append('<p><h6>Servings: <input type="text" value="' + yield + '"> servings'+ '</h6></p>')
嗯。谢谢。但是,我如何编辑文本? – 2013-04-30 05:53:54
你想要编辑什么文字? – dave 2013-04-30 05:54:59
收益值。我希望收益率作为主要价值,但可以改变。 – 2013-04-30 05:55:34
试试这个Examble
<!DOCTYPE html>
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js">
</script>
<script>
$(document).ready(function(){
$("#btn1").click(function(){
$("p").append(" <b>Appended text</b>.");
});
$("#btn2").click(function(){
$("ol").append("<li>Appended item</li>");
});
});
</script>
</head>
<body>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
<ol>
<li>List item 1</li>
<li>List item 2</li>
<li>List item 3</li>
</ol>
<button id="btn1">Append text</button>
<button id="btn2">Append list item</button>
</body>
</html>
请解释*不是p ..我试试* – hjpotter92 2013-04-30 05:44:53
对不起,错别字错误 – 2013-04-30 05:48:07