I am working with x-editable. My page has a button that disable/enable the editable property of inputs. Its working perfect without using Jquery.js file..But my layout includes Jquery.js file and its not working and getting 'typeerror -editable() is not a function'. Without this jquery.js there is no error and its working fine. how do i unload this js file from specific page? These are the scripts-
*<script id="js-file" src="~/Scripts/js/jquery.js"></script>*
<script type="text/javascript" src="~/Scripts/jquery-1.10.2.min.js"></script>
<script src="~/Scripts/js/x-editable/jquery.mockjax.js"></script>
<script src="~/Scripts/js/moment.js"></script>
<script src="~/Scripts/js/x-editable/bootstrap-editable.min.js"></script>
code of x-editable :
$.fn.editable.defaults.mode = 'inline';
$('.container .editable').editable('toggleDisabled');
$('#btnenable').on('click', function (e) {
e.stopPropagation();
$('.container .editable').editable('toggleDisabled');
});
removing js code:
function removejscssfile(filename, filetype) {
var targetelement = (filetype == "js") ? "script" : (filetype == "css") ? "link" : "none" //determine element type to create nodelist from
var targetattr = (filetype == "js") ? "src" : (filetype == "css") ? "href" : "none" //determine corresponding attribute to test for
var allsuspects = document.getElementsByTagName(targetelement)
for (var i = allsuspects.length; i >= 0; i--) { //search backwards within nodelist for matching elements to remove
if (allsuspects[i] && allsuspects[i].getAttribute(targetattr) != null && allsuspects[i].getAttribute(targetattr).indexOf(filename) != -1)
allsuspects[i].parentNode.removeChild(allsuspects[i]) //remove element by calling parentNode.removeChild()
}
}
removejscssfile("/Scripts/js/jquery.js", "js");
hurrah !! :) I found the answer myself:)
If there is any conflict between jquery occurs just write jQuery.noConflict();