readonly checkbox angular 1

readonly checkbox angular

//This will make all read-only check boxes truly read-only
$('input[type="checkbox"][readonly]').on("click.readonly", function(event){event.preventDefault();}).css("opacity", "0.5");

Here is what the above code is Doing:
1. It’s adding a class to all read-only checkboxes.
2. It’s adding a click event to all read-only checkboxes.
3. It’s adding a CSS rule to all read-only checkboxes.

The class is just for convenience. The click event prevents the checkbox from being checked or unchecked. The CSS rule makes the checkbox look disabled.

You can add the above code to your page in a script tag or in a separate JavaScript file.

If you want to make a checkbox read-only, just add the readonly attribute to it.

If you want to make a checkbox read-only using JavaScript, just add the readonly attribute to it.

document.getElementById(“myCheckbox”).setAttribute(“readonly”, “”);

If you want to make a checkbox read-write using JavaScript, just remove the readonly attribute from it.

document.getElementById(“myCheckbox”).removeAttribute(“readonly”);

If you want to make a checkbox read-only using jQuery, just add the readonly attribute to it.

$(“#myCheckbox”).attr(“readonly”, “”);

If you want to make a checkbox read-write using jQuery, just remove the readonly attribute from it.

$(“#myCheckbox”).removeAttr(“readonly”);

If you want to make a checkbox read-only using AngularJS, just add the readonly attribute to it.

If you want to make a checkbox read-write using AngularJS, just remove the readonly attribute from it.

If you want to make a checkbox read-only using React, just add the readOnly attribute to it.

If you want to make a checkbox read-write using React, just remove the readOnly attribute from it.

If you want to make a checkbox read-only using Vue.js, just add the readonly attribute to it.

If you want to make a checkbox read-write using Vue.js, just remove the readonly attribute from it.

If you want to make a checkbox read-only using Ember.js, just add the readonly attribute to it.

If you want to make a checkbox read-write using Ember.js, just remove the readonly attribute from it.

If you want to make a checkbox read-only using Backbone.js, just add the readonly attribute to it.

If you want to make a checkbox read-write using Backbone.js, just remove the readonly attribute from it.

If you want to make a checkbox read-only using Knockout.js, just add the readonly attribute to it.

If you want to make a checkbox read-write using Knockout.js, just remove the readonly attribute from it.

If you want to make a checkbox read-only using Meteor,

Similar Posts