Load cookie and remove disable attribute
I have a form with some select option like
- <select name="chart" id="chart">
- <option>Google Chart</option>
- <option>Flash Chart</option>
- </select>
- <select name="typeo" id="typeo" disabled="disabled">
- <option>Line Chart</option>
- <option>Pie Chart</option>
- <option>Bar Chart</option>
- </select>
Actually typoe options are created by json. After selecting chart it varries for google chart and flash chart.
I have disabled typeo and using jquery to enable it so every user select every necessary options.
I am using jquery like to remove attribute disabled
- $('#chart').change(function(){
- if($('option:selected', this).val() === 'None'){
- $('#typeo').attr('disabled','disabled'); }
- else{
- $('#typeo').removeAttr('disabled'); }
Later I found users have to select each and evry options every time when they will try to create a new chart so I thought about using cookie and I am using jquery cookie. I have successfully created the cookies. Now at first I have loaded the first option cookie
- var gcook= $.cookie('MyCookie1');
- if(gcook!=='null'){
- $('#chart').val(gcook);}
Now I am having problem the remove attributes are written on base of .change if I load the cookie at first then typeo option's disable attribute not getting removed. So can any one please tell me how can I use remove disable attributes and load cookies?
Thanks