I have a DIV like the one below:
<div class=”col-xs-6 form-field input_controls”></div>I want to change col-xs-6 to col-xs-12. I attempted this with the below code:
$('div').removeClass("col-xs-6 form-field input_controls").addClass("col-xs-12 form-field input_controls");
But I am getting an error stating :Uncaught TypeError: Cannot read property ‘removeClass’ of null.
Its more like your DOM structure is not ready when the javascript executes. So, you need to add a ready event:
$(function(){ $('div').removeClass("col-xs-6 form-field input_controls").addClass("col-xs-12 form-field input_controls"); });