Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/72.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
在html编辑器的文本区域中输入任何内容时,需要自动选中复选框_Html_Css_Extjs4 - Fatal编程技术网

在html编辑器的文本区域中输入任何内容时,需要自动选中复选框

在html编辑器的文本区域中输入任何内容时,需要自动选中复选框,html,css,extjs4,Html,Css,Extjs4,当我在HTML编辑器的文本区域键入任何内容时,我需要代码,然后自动选中其他复选框。你能帮我吗 下面是extjs代码示例 Ext.create('Ext.form.Panel', { bodyPadding: 10, width: 300, title: 'Pizza Order', items: [ { xtype: 'htmleditor', enableColors: false, enableAlignments: false, listeners:

当我在HTML编辑器的文本区域键入任何内容时,我需要代码,然后自动选中其他复选框。你能帮我吗

下面是extjs代码示例

Ext.create('Ext.form.Panel', {
bodyPadding: 10,
width: 300,
title: 'Pizza Order',
items: [
    {
    xtype: 'htmleditor',
    enableColors: false,
    enableAlignments: false,
    listeners: {
                render: function(){
                  this.textareaEl.on('keyup', function() {
                        var notes = this.textareaEl.getValue();
                        if(notes.length > 0) {   Ext.getCmp('checkbox1').setValue(true);
                        }
                        else
                        {
                            Ext.getCmp('checkbox1').setValue(false);
                        }

                  });

                }
            }
    },
    {
        xtype: 'fieldcontainer',
        fieldLabel: 'Toppings',
        defaultType: 'checkboxfield',
        items: [
            {
                boxLabel  : 'Anchovies',
                name      : 'topping',
                inputValue: '1',
                id        : 'checkbox1'
            }
        ]
    }
]   
renderTo: Ext.getBody()
}))

这是正确的方法吗。有人能帮我吗。提前谢谢。

像这样试试

<!doctype html>
<html lang="en-US">
<head>
    <meta charset="UTF-8">
<title></title>
<script type="text/javascript" src='./js/jquery-1.10.2.js'></script>
<script type="text/javascript">
    $(document).ready(function(){
        $('#my_textarea').keyup(function(){

            if($('#my_textarea').val().length>0)
            {
                $('input#my_checkbox').prop('checked', true);
            }
            else
            {
                $('input#my_checkbox').prop('checked', false);
            }
        });
    });
</script>
</head>

<body>
<input id='my_checkbox' type="checkbox"/><span>Some data here</span>
<textarea id="my_textarea" cols="30" rows="10"></textarea>
</body>
</html>

$(文档).ready(函数(){
$(“#我的文本区域”).keyup(函数(){
if($('#my_textarea').val().length>0)
{
$('input#my_checkbox').prop('checked',true);
}
其他的
{
$('input#my_checkbox').prop('checked',false);
}
});
});
这里有一些数据

简单地说。

你的经理告诉你这不是正确的方法吗?如果有效,那就太好了。对于样式和最佳实践,最好将代码发布在。真是个好地方。:)为什么这个标签上有jQuery?@Sarath Saleem请帮我搞错了没有。我编辑了thing@winner_joiner请帮我判断它是否错了。我已经编辑了上面的代码。你现在能帮我吗。我无法在JSFIDLE中登录和编辑。所以我编辑了同一个问题。什么是extjs版本?我使用的是extjs版本4.2,这是您在JSFIDLE测试用例中遇到的第一个错误。其次,this.textareaEl给出以下错误
uncaughttypeerror:无法调用未定义的方法“on”
在何处定义它?在
renderTo:Ext.getBody()
put