codingtcher.com
Theme Night
Home
Login

Remove attribute jquery

//remove required attribute jquery
$('#edit-submitted-first-name').removeAttr('required');

//remove attribute jquery
$("button").click(() => {
  $("div").removeAttr("id");
});

//jquery remove required attribute
//jQuery option 1
$('#fieldToRemove').prop('required',false);

//jQuery option 2
$('#fieldToRemove').removeAttr('required');

//with querySelector
document.querySelector('#fieldToRemove').required = false;
//jquery remove readonly
$('#id').removeAttr('readonly');

// or
$('#id').attr('readonly', false);

Related Code