I'm working with jQuery Mobile and I tried to refresh a flipswitch but when I try to do
$("#flipEnabled").slider("refresh");
I get an error in the console : Uncaught Error: cannot call methods on slider prior to initialization; attempted to call method 'refresh'
Is there a solution for this issue ?
Try the following:
if (!$('#flipSwitch').checked) {
$('#flipSwitch').prop('checked', false);
$('#flipSwitch').flipswitch('refresh');
}
Related
I recently upgraded from JQuery 1.9 to 3.3.1 and am getting an error in some of my old code relating to the $.parseHTML() function.
The docs state some changes in the behavior of this function but shouldn't effect my usage.
I'm trying to ajax GET a view, parse it, append it to modal content, and then show the modal.
success: function(editView){
//GETTING ERROR AT THE BELOW LINE
var html = $.parseHTML(editView, $('.modal-edit-content'), true);
//load editView into the modal content tag
$('.modal-edit-content').html('');
$('.modal-edit-content').append(html);
}...
This is the error:
jquery-3.3.1.min.js:2 Uncaught TypeError: t.createDocumentFragment is not a function
The code was working correctly in JQuery 1.9. Any ideas how to fix this?
I am using Telerik UI controls. They have a embedded JS, which looks like is having some dependency on Safari 9.0.3(10601.44) Developer console.
When we try to load telerik tree-view in telerik combo box, we get the followin error. Only in Safari 9.0.3(10601.44)
Same in text
_initRightToLeftScriptResource.axd:8396TypeError: null is not an object (evaluating 'c.set_additionalQueryString')
_initRightToLeftScriptResource.axd:8395
initializeScriptResource.axd:8332
endUpdateTelerik.Web.UI.WebResource.axd:2:49050
endCreateComponentsTelerik.Web.UI.WebResource.axd:2:63458
_raiseInitTelerik.Web.UI.WebResource.axd:2:65559
_doInitializeTelerik.Web.UI.WebResource.axd:2:63974
(anonymous function)Telerik.Web.UI.WebResource.axd:2:65784
(anonymous function)Telerik.Web.UI.WebResource.axd:2:50713
pTelerik.Web.UI.WebResource.axd:2:558
_2PassTelerik.Web.UI.WebResource.axd:2:50697
My problem is very similar to this Why does JavaScript only work after opening developer tools in IE once? but in Safari.
I tried all those suggestions, none of them were helping.
Update
Code works fine with some delay in calling function.
if (navigator.sayswho === "Safari 9") {
setTimeout(function() {
try {
loadInit();
} catch (e) {
alert("error");
console.log(e);
}
}, 1000);
tried all following, none is working, not sure how to trace the right event of full DOM is loaded and no pending ajax calls happening.
$(document).load(...)
$(window).load(...)
<body onload="....">
Since you are using Telerik controls, use:
Sys.Application.add_load(MyFunction);
function MyFunction(sndr, args){
//your code
}
This only calls the function once all the telerik controls have loaded.
I had implemented this jQuery Cycle with Rotate and Tabs in a previous application and it ran without any problem because the rotate method was included within jQuery UI. My previous app used jQuery 1.6
Now I am trying to implement this in a .NET application that is Bootstrap enabled, I'm using jQuery 1.11.2 and Bootstrap 3.
There is an issue because rotate method has been removed from jQuery UI Tabs.
So I added jquery-ui-tabs-rotate.js
Chrome Console shows 2 errors:
1. Cannot read property 'tabs' of undefined from rotate
2. Another issue is: $(...).tabs is not a function
$("#featured > ul").tabs({ fx: { opacity: "toggle" } }).tabs("rotate", 5000, true);
Here is the Test Page
I also tried to add the latest Cycle CDN which didn't fix the problem:
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.cycle/3.03/jquery.cycle.all.min.js"></script>
I was wondering if anyone knows why this jQuery Cycle Tabs isn't firing?
I simplified the Code, removing the other JavaScript made no difference:
$(document).ready(function () {
$("#featured > ul").tabs({ fx: { opacity: "toggle" } }).tabs("rotate", 5000, true);
});
It looks like the rotate method has been removed from jQuery UI Tabs, as you can see by this error message appearing in the console of your page:
Uncaught Error: no such method 'rotate' for tabs widget instance
Doing a search reveals that this method was removed from jQuery UI Core. It looks like you can implement a third-party extension to fix this.
So I've got the following code that works in jsfiddle, but not on the actual website, which leads me to believe that the only way I'm going to get it working is for someone with more experience than I to look through the source and see what's interfering.
<script>
$(document).ready(function(){
var $elements = $('body').children('div[class^=class]').on('click', function () {
$elements.removeClass('classname')
.not('.' + this.className)
.addClass('classname');
});
});
</script>
Website: http://sinfulgurotesque.tumblr.com/recs
Edit: I've removed a section of code from the website that had nothing to do with this part. (It was the deprecated code, and it didn't offer much in terms of functionality anyways.)
You're using jQuery 1.10.1 in your page, and the error you're getting:
jquery.style-my-tooltips.js:26 Uncaught TypeError: undefined is not a
function
is referring to the .live() function used by the plugin which was removed in jQuery 1.9
$(".smt-current-element").live("mouseout mousedown click",function(){
It looks like you're calling depracated JS functions. I got:
TypeError: $(...).live is not a function
when opening your page. Try changing .live() to .on()
Like so
$("body").on("mouseout mousedown click", ".smt-current-element", function(){...
i want to show loading gif until data loaded with jquery mobile
but it does not work ..in console it give that error
Uncaught TypeError: Object #<Object> has no method 'loading'
this is my page :enter link description here
and in this page that i added code
$.mobile.loading( 'show');
and this not work:enter link description here
my code
<script type="text/javascript">
$('#details').live('pageinit', function (event) {
$.mobile.showPageLoadingMsg();
$("#listeu").empty();
$.getJSON('http://teknonova.com/Map/Home/getir3/1', function (data) {
The error sounds like either the jquery mobile library wasn't loaded properly (maybe loaded before jquery and failed init) or the version of jquery mobile doesn't support that method.
I'd use the dev console to see what the $.mobile object is for more clues