Javascript Jqgrid-以编程方式设置textarea
我有一个基于表单编辑的功能网格。在表单上,我想根据“rule.id”中的选择设置“eventprocessor.configuration”的值 如您所见,“rule.id”具有dataEvents,用于在值发生更改时捕获该值-这将起作用并显示在alert()中。但我不知道如何设置“eventprocessor.configuration”中的值 我试过Javascript Jqgrid-以编程方式设置textarea,javascript,jquery,jqgrid,textarea,Javascript,Jquery,Jqgrid,Textarea,我有一个基于表单编辑的功能网格。在表单上,我想根据“rule.id”中的选择设置“eventprocessor.configuration”的值 如您所见,“rule.id”具有dataEvents,用于在值发生更改时捕获该值-这将起作用并显示在alert()中。但我不知道如何设置“eventprocessor.configuration”中的值 我试过 $('textarea#eventprocessor.configuration').val(this.value) $('textarea#
$('textarea#eventprocessor.configuration').val(this.value)
$('textarea#eventprocessor.configuration').html(this.value)
$('textarea#eventprocessor.configuration').text(this.value)
……但这些都不管用
我的代码
...
{
name: 'rule.id',
index: 'rule.id',
editable: true,
edittype: 'select',
editoptions:
{
value: '<?php echo $rules; ?>',
defaultValue: 0,
dataEvents: [
{
type: 'change',
fn: function() {
alert(this.value);
$('textarea#eventprocessor.configuration').val(this.value)
}
}
]
},
editrules: {required: true}
},
{
name: 'eventprocessor.configuration',
index: 'eventprocessor.configuration',
editable: true,
edittype: 'textarea',
editrules: {required: true},
editoptions: {rows: 4},
required: true
},
...
。。。
{
名称:“rule.id”,
索引:“rule.id”,
是的,
edittype:'选择',
编辑选项:
{
值:“”,
默认值:0,
数据事件:[
{
键入:“更改”,
fn:函数(){
警报(该值);
$('textarea#eventprocessor.configuration').val(this.value)
}
}
]
},
editrules:{required:true}
},
{
名称:“eventprocessor.configuration”,
索引:“eventprocessor.configuration”,
是的,
edittype:'textarea',
editrules:{required:true},
编辑选项:{rows:4},
必填项:true
},
...
我通过搜索找到的代码并不能解决我的问题,即使它似乎对其他人有用。基于“rule.id”设置“eventprocessor.configuration”的值缺少什么
非常感谢。我想这是因为文本区域id中的句号。试试这个:
$('#eventprocessor\\.configuration').text(this.value);
jsiddle:是否先尝试将其拉入变量?类似于
var textValue=this.value$('textarea#eventprocessor.configuration').val(textValue)代码>。另外,您确定eventprocessor.configuration
是文本区域的id吗?您的正式回答成功了。是的,id实际上是“eventprocessor.configuration”。再次感谢。太棒了,没问题:)