I cannot coax the datetimepicker to work. Datepicker works fine. But the add-on has not worked after about 7 hours of attempts.
Firebug shows no 404's.
All jQuery libraries are included with the theme framework as well.
I tried replacing all instances of $.datepicker with jQuery.datepicker in the script. This made no difference.
I tried moving scripts above or below or combining them. The same error persists. I have examined several related answers in this forum and many, many others to no avail. I have reviewed jQuery literature but it does not address this specific problem..
My code is this. Just a couple of html inputs. Datepicker works fine.
`jQuery(document).ready(function(){
jQuery('#datepicker').datepicker();
});
jQuery(document).ready(function(){
jQuery('#datetime').datetimepicker();
});`
This segment of code works fine. Datetimepicker then hits the line
$.datepicker.parseDateTime = function(dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings) {
$.datepicker not defined.
If you do not know the answer, perhaps there is a way for javascript/jQuery to produce more detailed information about its failures?
Change to this
jQuery(document).ready(function(){
$.datepicker.parseDateTime = function(dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings){};
});
Looks like you are trying to call the function before it gets loaded. Jquery will go through each doc.ready function in order, so as long as this is after the initial load it should work.
Also, use chrome's built in develop tools for debugging purposes. Ctrl-shift-j on a PC will open them up, you can see the console messages to figure out whats going on.
heres a jsfiddle to show the working syntax http://jsfiddle.net/XA79k/
( function($$) {
$$(document).ready(function(e) {
$.datepicker.parseDateTime = function(dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings) {
});
} ) ( jQuery );
I had similiar issues and had to do it this way since there was conflicts. And I tried jQuery.noConflict() aswell, but didnt work. Above code worked for me.
Related
I have a wordpress website and I want to show my video using fancybox, so I tried wp plugin like "fancybox for wordpress" and "easy fancybox".
But both of them give me the error message "Uncaught TypeError: jQuery(...).fancybox is not a function".
I search for many questions on here and found this can be jquery conflict, but I cannot figure out where is it.
here is my site http://skyblueenglish.co.uk
Notice that I only have one of above plugins at one time.
as per my thinking and till i have checked, what happen is,
in word-press you have included fancybox jQuery and it will obviously installed when you have installed the plugin. Now what happen is ,while using some JS function or JS Class it is mandatory to include jQuery file before we use/include the third party JS.
I checked the "View Source" for your page.
<script src="http://skyblueenglish.co.uk/wp-content/themes/skybluetheme/js/jquery.min.js"></script>
and i found that above JavaScript file is included in the footer.
i just removed that line and put it before
<script type='text/javascript' src='http://skyblueenglish.co.uk/wp-content/plugins/fancybox-for-wordpress/fancybox/jquery.fancybox.js?ver=1.3.4'></script>
and the error is Gone.
so what you have to do is, you have to find your footer, find the included jquery.min.js . remove it from the footer and include it from header.
Let me know if you dont understand anywhere.
;( function( $ ) {
$(document).ready(function(){
$(".fancybox").fancybox({
//....
});
});
} )( jQuery );
I did so many experiments on same topic and also tried with many different way to solve according to wherever I found similar topics on internet but trust me nothing worked out for me and then finally I simply tried to see what exactly error says:
Uncaught TypeError: $(...).fancybox is not a function
and for which I simply removed a line which was saying if($.fn.fancybox!==null).
I am not strong enough to understand Javascript or Jquery thing being fresher so I just tried with simple logic and it worked for me lol.
This might not be the right solution but just thought to share my experience so maybe for someone it may work too.
It worked properly without loosing any function by removing below code
if($.fn.fancybox!==null)
{$("a[class^='fancyBox']").fancybox();
$("a[class^='fancybox-thumb']").fancybox(
{helpers:{title:{type:'outside'},thumbs:{width:50,height:50}}});}
Thank You!
I've been trying to get the dayClick in the FullCalendar plugin to work, but when I click nothing is happening. Can't figure out what it is I'm doing wrong. I click on a day, but no alert message. jsfiddle below. What am I doing wrong.
http://jsbin.com/bicawa/2/edit
I don't really know this library but you had two non-related issues in your code:
The moment script tag was placed before jQuery, my guess it should be placed after.
You had four slashes in your moment src (i.e. src="https:////...")
After fixing these two issues I got the console.log to work, but for some reason the alert() still wasn't working.
alert is turned off in JSBin. You shouldn't debug with alert because it stops code execution. While JSBin is a great tool for building quick samples, it makes debugging harder.
And as #idoberko2 says: You should put jQuery as first included script.
Here is a working JSBin
I wrote a page that used buttons with onclick to call a function as part of a set of practice problems and answers for my students. It has worked since July with no issues through Friday, September 5 at least. Today the buttons fail to function at all in Chrome, and I can't figure out why for the life of me. They do continue to function properly in IE.
I've posted the simplest code I could write that won't work below. It's awfully simple, and honestly I think it's fine. It seems to work if I paste the entire thing into JSFiddle's HTML box, but if I try to separate the script it doesn't do anything. I don't know whether that's because it's broken or because I am separating it incorrectly though.
I'm having trouble trying to debug it, largely because Google Sites completely rewrites your work into its own format which is more or less unreadable without being made of silicon. When I load this and try to click, I do get an exception:
Uncaught Error: shouldn't happen: ES5/3 object passed to makeDOMAccessible
But I have had absolutely no luck with figuring out what is happening there, or whether that is even really the problem or not.
I've read a lot about Google Sites being picky with Javascript, and I don't know whether the issue is with Sites or Chrome or the two together or what, but it's something that I'd like to get sorted out, as the bulk of my students and I primarily use Chrome.
All of the code below is going into an inserted HTML box as written, just FYI.
Apologies if this turns out to be a duplicate; I searched for quite a while and couldn't find a solution.
<html>
<body>
<button onclick="Check()">Push Me</button>
<script>
function Check() {
alert("It worked");
}
</script>
</body>
</html>
Any suggestions for fixing what I've got (if it's even broken) or redoing it in a straightforward way that would work with Sites and Chrome would be welcome. Thanks in advance.
Here is one full page that was working previously in Chrome and is no longer. It displayed the rows of a table as you pressed the various buttons.
EDIT: This appears to work in older versions of Chrome. I guess I need to hit up the Chrome forums with this issue.
The workaround suggested by epascarello, using addEventListener in place of onclick events, seems to work. I still can't get the alert window in my example to work for some reason (against Sites policy?), but the actual functionality I wanted, setting the innerHTML of a paragraph object, is working properly.
This appears to be an issue between Google Sites and Chrome v.37. Hopefully it is resolved in the near future.
Here is an example of equivalent code that is working correctly.
<html>
<body>
<button id="AnswerButton1">Check Answer 1</button>
<p id="Answer1"></p>
<script>
document.getElementById("AnswerButton1").addEventListener("click",function(){Answer(1);});
function Answer(n){
document.getElementById("Answer"+n).innerHTML = "Answer to Number 1";
}
</script>
</body>
</html>
Thanks to those who helped.
Sorry for bad title, but I'm at a loss here.
I am implementing akottr's dragtable jquery for reordering columns in a table, and have no luck, source code and demos here https://github.com/akottr/dragtable and here http://akottr.github.io/dragtable/
In the source .js file I put,
$(document).ready(function () {
$(".reorderable").dragtable();
});
And my table has reorderable in its class, which should have been all I need
I get:
Uncaught TypeError: undefined is not a function
on $(".reorderable").dragtable(); in Chrome dev tools surprise surprise $(".reorderable").dragtable returns an undefined
The demo works and is the same source files, am I missing something to register the dragtable method?
I tried to use dragtable today and got the same error. The error went away when I corrected the order javascript files were loaded and also I used the dragtable.js from demo
http://rawgit.com/akottr/dragtable/master/jquery.dragtable.js
its working fine for me. Seems like a very old question,may it help others :)
I have never tried to use javascript in wordpress post before. Today, when I tried it does not work. I tried several scripts, and none work.
For example,<Script type="text/javascript"> alert("test");</script>
In the past, I have tried to use SweetCaptcha, and it did not work. I am thinking this may also have to do this issue.
Has anyone had a similar situation?
I have disabled ALL plugins just to ensure there are no conflicts with them.
I deactivated all plugins again, and activated them, and now it works. I did this several times before, but I guess that was the issue
Remove all spaces from your code. Try this:
<script type="text/javascript">alert("test");</script>
I have never tried to use javascript in wordpress post before.
Javascript should work if pasted into the HTML version of the Post/Page editor. It does not work if pasted into the visual editor. If pasted into the visual editor the string will be encoded and won't work. I just tested it.