Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/85.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/asp.net-mvc-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无法使用jquery读取@Html.TextArea_Jquery_Asp.net Mvc 3_Razor - Fatal编程技术网

无法使用jquery读取@Html.TextArea

无法使用jquery读取@Html.TextArea,jquery,asp.net-mvc-3,razor,Jquery,Asp.net Mvc 3,Razor,我尝试了很多方法,但无法使用jquery将值分配给@Html.TextArea 我试过了 $("#taeditor").attr("value", "testing"); $("#taeditor").val("testing"); $("#taeditor").html("testing"); 但是什么都不管用,如果你有任何线索,请帮忙。你需要像 @Html.TextArea("Textarea", new { id = "testing"}) 然后使用 $("#testing").val

我尝试了很多方法,但无法使用jquery将值分配给
@Html.TextArea

我试过了

$("#taeditor").attr("value", "testing");
$("#taeditor").val("testing");
$("#taeditor").html("testing");

但是什么都不管用,如果你有任何线索,请帮忙。

你需要像

@Html.TextArea("Textarea", new { id = "testing"})
然后使用

$("#testing").val();

请在您的问题中提供呈现的html。您可以显示
@html.TextArea
的代码吗?我敢打赌您使用的ID不正确。。。尝试
$(“textarea”).val(“测试数据文本”)。如果这不起作用,jQuery要么没有被加载,要么代码没有被包装在一个文件中。下面是呈现的html@html.TextArea(“page”,htmlAttributes:new{@class=“ckeditor”,onchange=“return this;”,@id=“taeditor”})我看到当我分配类ckeditor时,它正在解决问题。现在,ckeditor基本上是通过附加的格式化控件来转换textaria。感谢您的回答,虽然这是可行的,但是ckeditor类在我的textaria上遇到了问题