alert called by onload event not running? [closed] - javascript

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I'm creating a chrome extension, but I'm struggling with the Onload event. I'm not sure what's wrong with my code. It works when I run it from this code snippet, but not in my text editor. I've tried disabling Jslint but it still won't show the alert. The problem could be in running the function, calling the alert, or calling the onLoad event, but I'm not sure. I'm testing it using a chrome-based preview tool in the brackets text editor. Any idea what's going on and why?
function showAlert() {
alert ("you are an idiot");
}
<script src="justanotherfile.js"></script>
<body onload="showAlert()"></body>

Did you include this in the manifest file?
"scripts": [
"justanotherfile.js"
]

Related

Javascript setTimeout will not work in my script [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 21 hours ago.
Improve this question
I want to set a delayed event, using setTimeout. No big thing, except it isn't working and it has been taking me hours to figure out why.
So, I went to W3Schools to check and found this example:
https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_win_settimeout1
Working fine there, so I copied the logic to my own HTML file on my machine. No way, it doesn't work.
I do not understand how such a simple thing can behave differently on the same machine, browser and version simply because one is sitting at W3Schools and the other at my plain HTML script.
This is the script I copied:
<script>
let timeout;
function myFunction() {
timeout = setTimeout(alertFunc, 3000);
}
function alertFunc() {
alert("Hello!");
}
myFunction();
</script>
Doesn't work when copied to my machine.

Jquery .click() causes code to break [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
Adding this line of code $("#locate-me-button").click(loadLocation()); breaks my entire JavaScript code file even if I don't click the #locate-me-button element. When this line is commented out the entire file works perfectly again. Why would that be?
You are invoking the function as passing its return value to event handler, just pass the function reference to .click()
$("#locate-me-button").click(loadLocation);
//^ () is removed
The another way (at least for case that you have parameter):
$("#locate-me-button").click(function(){
loadLocation();
});

Wordpress issues with loading the website on Firefox [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
as mentioned in the Title, when I load my Website on Firefox there seem to be rendering problems. Although when I load it on Chrome or Safari it looks and renders as it should.
I will post some screenshots to make the issue even clearer.
Many thanks in advance for your help.
Website view on Firefox
Website view on Chrome
Error on below line, correct it.
src: url(‘library/fonts/destroy_-webfont.eot');
Correction:
src: url('library/fonts/destroy_-webfont.eot');
Seems as if you are missing some css. Check to see if the css files are being loaded properly in the developer console. If they are being loaded correctly, then you may need to add some mozilla specific styles.
Are there any other errors in the browser console that would prevent execution of the css?
Welcome to the world of cross browser compatibility issues.

Conflict in jQuery [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
Right so I've got a bit of jQuery that exposes a couple of divs on the right hand side of my page. Here's the test link that works:
TEST
Now when I integrate that into my site it doesn't work at all and I can't find the glitch. I've just copied the entire page from the test into my layout page as, no matter what order I put it in it doesn't work. Can anyone identify the bug? I'm sure I'm doing something wrong that is so simple but need a bit of professional guidance. Here's the non-working link:
SITE
Uncaught TypeError: Object #<Object> has no method 'onEnd'
sublimevideo.ready(function() {
sublimevideo.onEnd(function(sv) {
sublimevideo.stop();
});
});
That is where your error is, .onEnd() is not jQuery.
Syntax error bro :)
Czas: 04.07.2013 14:00:21
Błąd: SyntaxError: syntax error
Plik źródłowy: http://www.quotesin.co.uk/index.php
Wiersz: 76, Kolumna: 51
Kod źródłowy:
jQuery('#userNav').show('slide',,1000);
I opened the SITE link in Firefox with Firebug running and found this syntax error:
jQuery('#userNav').show('slide',,1000);
Firebug is pointing to the second comma after slide on line 84.
Are you using Firebug or some other developer's tool such as the ones available in Chrome or Safari to do your debugging?

IE8 JQuery error [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
I'm working on this website: link
Everything works in the modern browsers, but in IE8 if I click on a plus sign in the left menu, I get an error.
The error is in the 52. line of this js: js
content = $(link).parent();
Error is
Object doesn't support property or method
From seeing your script,
togglemenu($(this));
function togglemenu(link){
content = $(link).parent();
...
...
}
you can directly have
content = link.parent();
Well content is not defined anywhere that I can see, maybe that is the problem?
Try this-:
$(link).closest('your closest parent')
Documentation=http://api.jquery.com/closest/

Categories

Resources