每当单击提交按钮时,我都会尝试更改段落内的文本。由于某种原因,它不起作用。我尝试在其他问题中找到答案,但不能。为什么这不起作用?Javascript代码:
var $submit = $('input:submit');
$submit.click(function(){
var $newText = $('input:text').val();
var $p = $('#newStatus');
$p.text($newText);
});
html:
<div class = "grid_12">
<form>
<input type="text" name="status">
<input type="submit" name="submit" value = "Post">
</form>
<p id = "newStatus"></p>
</div>
谢谢!