my problem is a plugin called "Sexy Alert Box" when I load the page, the firebug tells me that there is a problem:
$ is not a function
The line with the error shows...
$(document).ready(function(){
You can check the website HERE
and when I try to click on "Dile a un amigo" for open the box, because the plugin is not define it says
"Sexy is not defined"
I hope that you can help me to fix this, Thank you
This is rather a wild guess from a short look at your source code, but it seems like you called var $jquery = jQuery.noConflict(); which means jQuery wont export the $ symbol, so you cant use $(document)... syntax you´ll have to use the $jquery or jQuery variable as you already did in your document. See the jquery documentation on this. Maybe your plugin does not support the noConflict mode and relies on the $ symbol to be available?
used jQuery.noConflict() so instead of using $ try using $jquery there
It's because of this line I believe:
var $jquery = jQuery.noConflict();
on line 56 of you page.
It removes the $ binding so you have to user $jquery().
Its to allow compatibility with other frameworks that use $.
Change
$(document).ready(function(){
to
$jquery(document).ready(function(){
Related
I have a Problem with the following script: http://code.google.com/p/pwi/
This is a very nice Picasa jQuery Gallery!
Can someone please tell me how i run this script in jQuery.noConflict() mode? I have already added the line...
<script>jQuery.noConflict()</script>
...in the HTML file and replace all $ with jQuery. But then the script doesn't work anymore.
Nobody can help me? I have the Demo 1 from this ZIP file
with fancybox.
Normally i need only replace $ with jQuery in the .html and .js files, and then add the jQuery.noConflict() to the head. But here doesn't work...
The error console in Firefox says:
Error: TypeError: n.gphotojQuerytimestamp is undefined
Source file: file:///C:/Users/pc/Desktop/jquery.pwi/js/jquery.pwi.js
Line: 361
Looking at the page from jQuery (http://api.jquery.com/jQuery.noConflict/) you can use two methods.
I did a quick test, and it looks like you can use the second method. If you modify Demo1 like this:
In the script section where PWI is initialized add these lines before var $viewerSelected = "fancybox";:
$.noConflict();
jQuery(document).ready(function($) {
// Code that uses other library's $ can follow here.
Just before the closing end-script tag add the lines
});
// Code that uses other library's $ can follow here.
This at least makes sure that the code is still running without errors
I'm definitely NOT using another library for my WP installation and I'm loading lots of external js files that rely on the use of $. So I need to load jQuery WITHOUT the non-conflict mode.
I've seen 3 different ways:
a) deregistering present Jquery script and registering mine, (without the .noConflict() call in the last line)
b) using this code (but I can't add all my js files there)
(function($) {
$(function() {
// more code using $ as alias to jQuery
});
})(jQuery);
c) just assigning
$ = jQuery
I'm not sure what the pros and cons are (I guess b method only works for in-line code, not for adding my own jquery based js files which expect $ to be available)
Please advice!
a) make sure your 'own' version is compatible with wordpress.
c) make sure this statement is executed before including other jquery lib (the ones which expect $).
a and c) I won't do this for admin side
I am trying to load html file in CKEditor in asp.net but for some reason I don't know how to put the html code from the code behind file.
CKEditor1.FilebrowserBrowseUrl = url;
CKEditor1.BasePath = url;
CKEditor1.Text = content;
none of that helped
Any advice? Thanks in advance, Laziale
I'm not sure which version you are using, but let's suppose that it's 3.x. I was playing around with the control and didn't find any possible way of doing this from code behind. However, I managed to make it work like this:
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "fckInitialization", #"
window.onload = function () {
var oEditor = CKEDITOR.instances['" + txtPost.ClientID + #"'];
oEditor.insertHtml('<strong>This is a bold text.</strong>');
};
", true);
I tried it in IE 8 and the last version of Mozilla (I think it was 9) and it worked. I also tried the same thing, but instead of window.onload I used the jQuery $(document).ready() and it worked only in IE. The reason is that you have to wait for everything to load in order to use the functions from the CKEditor API. I played with Firebug and the insertHTML worked.
If you are using 2.x, you can see somewhere in Google the same approach, but with a different API. I just can't find the link right now.
Another problem will be here, as you may figure out, that if you want to initialize a long text, you will have to write everything in a script, which is not really nice.
Maybe a possible solution for you will be to convert the HTML to BBCode first and then just set the Text property. This, of course, depends on the way you use the control, because BBCode does not contain all possible tags, but you can always modify the bbcode plugin of CKEditor to meet your needs. And I tested it and it works.
PS. Probably you can do it with the JavaScript method and an AJAX call.
Hope this helps!
Assuming ckeditor is being initialized from a textarea field, you can simply populate the body of the textarea.
Hi all
i put jquery file in master page version jquery-1.4.2.min.js and in another page
jquery file jquery-1.2.6.min.js just in Firefox the jquery features don't work
JavaScript doesn't support class, function or whatever library.
You're just including jQuery twice - different versions -.
If you want to use both, you'd need to change jQuery prefix.
Version A: $
Version B : $$
Or any other valid prefix.
You can do so by changing jQuery object name to jQueryA and jQueryB, and at the end of jQuery source code, change the "$":
// Expose jQuery to the global object
window.jQueryA = window.$ = jQueryA;
...and:
// Expose jQuery to the global object
window.jQueryB = window.$$ = jQueryB;
It's not a good approach so far, but maybe your requirements are leaving an old version of jQuery for some tasks because you don't support some code, and you want to do some new feature with another and newer jQuery version...
What happens when you include jquery a second time, is that it forgets all customizations that has been made since the first include. So the solution is simple: Dont include it twice.
I have a page that has a simple javascript in the header portion of the page:
<script type="text/javascript">
function doLogout() {
var conf = confirm("Really log out?");
if (conf === true) { //changed == to === for boolean comparison
$.post("logout.aspx");
}
}
</script>
It uses jQuery to do an AJAX post to my logout page. The only issue right now is that when I click on the link (logout) to fire this function, nothing happens. I checked FireBug's console, and it told me that the function is not defined. This has happened to me before, but I think I botched a bunch of code to fix it sometimes.
Does anyone know the proper way to fix this issue?
Edit
After doing a lot of googling and trying different things, I found this very concise and informative post. Apparently, as the linked article states, the way the script is referenced in the web site is important as it won't run properly otherwise! Hopefully this information will be useful for more people.
This can also occur if there is a syntax error earlier in your javascript code. Often this will just be interpreted as the function not existing (nor any function AFTER the error). Check the code above this code (if there is any) and this code for syntax errors.
A way to tell if the cache error is it is to open Firebug and view the Script source. If the page was cached, you won't see your code. If it loaded but has syntax errors, the code will show, though it won't "find" it.
Things to test:
1) Can you call this function from something else? Like add a <script> at the bottom of the page to call it?
2) Does the page validate? Sometimes I get screwy javascript errors if there is some busted HTML like a missing </b>
3) I've been starting to wrap my javascript in <![CDATA[ ]]> just incase I've got goofy chars in my javascript.
4) I assume you've tested this in other browsers and have the same behavior, right?
5) If you haven't installed it already, install the Web Developer firefox addon. It has a nifty toolbar menu that will disable the cache for you so everything reloads.
6) As weird as it sounds, I once hit a javascript issue that was because of how my text editor was saving UTF-8 files. I forget the details, but it was adding some byte-order-mark or something that upset the browser.
I've had this occur when the page had been cached and so it didn't load the new script in. So to fix it clear all private data from Firefox. Not sure if that helps but it sure happened to me a bunch.
Other ideas for you to test:
is the function defined in the DOM tab in FireBug?
if you call doLogout() from the FireBug console, what happens?
I assume this is not the only script on that page. Make sure that some later script is not modifying doLogout to something else
I had the same issue and tried all that's been suggested here without success.
The only way I fixed it was by discovering that in the <script src="jquery.js"> tag I was using in the head of the page I forgot to close it with its </script> causing the page to ignore all Javascript functions. So please check that your includes look like:
<script src="jquery.js"></script>
I hope that helps. Ross.
If you are using DevExpress controls these links may help you: How to register and execute a JavaScript downloaded to the client via a callback and How to register and execute a JavaScript downloaded to the client via a callback (standalone JS file) and Executing javascripts from user controls dynamically created through ASPxCallback panels
The issue might occur if you have NoScript. You should check and make sure it's not blocking said script.
I had this issue and discovered the problem was just a wrong case letter inside the name.
Call: filterCheckbox()
vs
function filterCheckBox() {}
problem: lowercase "box" vs uppercase "Box".
So check if the name is exactly the same.