extjs - Change color of checkbox field when checked -


i have check box field box label colored in green. need change color of boxlabel (say: yellow) when user checks checkbox. tried validating checkbox, doesnt work. suggestions?

xtype :  'checkbox', id: 'checkbox1', name : 'checkbox', style: 'background-color : #bcf5a9', boxlabel: 'mycheckbox' //i tried below handler function. doesnt work handler: function (checkbox, checked) {             if (checked) {                 style : 'background-color: #ddd';             } } 

if need change color of boxlabel, try way.

ext.create('ext.form.panel', {    bodypadding: 10,     title: 'checkbox test',     items: [{      xtype: 'checkboxfield',      id: 'checkbox1',      name: 'checkbox',      style: {        color: 'green'      },      boxlabel: 'mycheckbox',      handler: function(checkbox, checked) {        if (checked) {          checkbox.el.setstyle("color","red");          //checkbox.setboxlabel('<span style="color:red">mycheckbox</span>');        } else {           checkbox.el.setstyle("color","green");          //checkbox.setboxlabel('<span style="color:green">mycheckbox</span>');        }      }    }],    renderto: ext.getbody()  });
<script type="text/javascript" src="http://cdn.sencha.com/ext/gpl/4.2.0/ext-all.js"></script>  <link rel="stylesheet" type="text/css" href="http://cdn.sencha.io/ext-4.2.0-gpl/resources/css/ext-all.css">


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -