Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uncaught TypeError (jQuery) - setting readonly

I have a bootstrap-switch set up, I just want to set one of the items to read only.

I have tried:

$('#charge').bootstrapSwitch('setReadOnly', true);

But I get: Uncaught TypeError: Cannot read property 'apply' of undefined

The HTML is:

<input name="name1" type="checkbox" class="item-types"
       id="charge"
       data-size="large"
       data-indeterminate="true"
       data-on-text="YES"
       data-off-text="NO" />

What am I doing wrong?

like image 200
b85411 Avatar asked Feb 03 '26 19:02

b85411


1 Answers

Looks like you may have the first parameter wrong. Should be

$('#charge').bootstrapSwitch('readonly', true);

http://www.bootstrap-switch.org/options.html

like image 161
James Grundner Avatar answered Feb 05 '26 07:02

James Grundner