Search code examples
javascripthtmljquerycssknockout.js

Uncaught: Type error: this.removeClass is not a function


I have a common pagination code, cshtml in the form of a partial view:

<div id="paging">
<span></span>
<span></span>
<a data-mini="true" class="action ui-btn" data-bind="css: previousPageEnabled() ? '' : 'ui-disabled'">&lt;</a>
<a data-mini="true" class="action ui-btn" data-bind="css: nextPageEnabled() ? '' : 'ui-disabled'">&lt;</a>
</div>

The respective js code for this is:

(function($, model){
function injectPaging(viewModel. selector, pageSize){
//Code that does the pagination part
}
}

The main view is using jquery: jquery.mobile-1.4.5.js Through the debugger console, it is giving me error at this line(9408):

this.removeClass( "ui-flipswitch-input" );

Link to the jquery page: http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.js

Now the issue is, this code is working fine for all the pages as this pagination is used by all the other views that implement pagination and only giving issue for one view. I don't want to change anything in the jQuery file and I am having no clue what might be causing the exact issue.


Solution

  • As per jquery-mobile Github instead of concerned line try using this:

    this.element.removeClass("ui-flipswitch-input");
    

    You can try updating the jquery-mobile to 1.5.0-rc1, the bug seems to be fixed there.