$("#input").keyup(function(){
console.log($(this).val());
})
Problem is when one is typing slowly "a" & "b" the above code will result in "a","b" in console log. But when somebody does it quickly the result is "ab","ab". It's easier to do with letters which are near on a keyboard eg. "e"&"r". How to avoid it?
Events keydown and keypr...
Hi,
I want to pass a parameter to some javascript using a single line of code, like this:
<script language="JavaScript" src="courselist.js?subj=MATH" type="text/javascript" />
Inside the javascript file, how can I get the value of the parameter "subj"?
Thanks
...
I'm using galleriffic to handle my image gallery and I'm having a problem with the thumbnail active states.
Galleriffic doesn't have support for active states on the images - only the list items. Right now the gallery will assign a "selected" class to the current LI containing the thumbnail and I've been trying to use jQuery to target t...
I'm writing a simple platform game using javascript and html5. I'm using javascript in an OO manner. To get inheritance working i'm using the following;
// http://www.sitepoint.com/blogs/2006/01/17/javascript-inheritance/
function copyPrototype(descendant, parent) {
var sConstructor = parent.toString();
var aMatch = sConstruct...
I have a status page that I would like to periodically reload. Instead of coding a refresh action into the page itself, I would like to have a wrapper page handle the periodic reloading. Any such thing available off the shelf?
Something I could use like this would be perfect:
http://foo/automatic-page-reloader?interval=60&page=ht...
Hi
In my application, I allow users to write plugins using JavaScript. I embed V8 for that purpose. The problem is that developers can't use things like HTTP, Sockets, Streams, Timers, Threading, Crypotography, Unit tests, et cetra.
I searched Stack Overflow and I found node.js. The problem with it is that you can actually create HTTP...
So I have something like
<div>
<!-- other stuff then-->
<button>Hey</button>
</div>
and I'd like to make that (using Javascript/JQuery)
<div>
<!-- other stuff then-->
<div class="bw">
<button>Hey</button>
</div>
</div>
Is that possible? I couldn't find anything with material on it online…but, I'm a totally JS noob, so...
I'm trying to wait and then get a message when all images in an array have completed loading (using .complete), per the answer here. As such I set up an infinite loop like the below. however, when I run this I get an error that checkForAllImagesLoaded() is not defined. This code is being run through a bookmarklet, and as such it's all ...
Hi,
I have the following code that I am playing with:
<script type="text/javascript">
var Dash = {
nextIndex: 0,
dashboards: [
{url: 'http://www.google.com', time: 5},
{url: 'http://www.yahoo.com', time: 10}
],
display: function()
{
var dashboard = Dash.dashboards[Dash.nextIndex];
p...
Does executing javascript within a browser in 'strict mode' make it more performant, in general? Do any of the major browsers do additional optimisation or use any other techniques that will improve performance in strict mode?
Edit: Since none of the major engines actually implement strict mode, I'll rephrase slightly: Is strict mode in...
I want to enable drag-and-drop behaviour on my Web application. I have an image I want to drag. The image is behind another one that has transparent sections so that you can see the image beneath it. I do not want to change the order of the images. My thinking is I should use another layer on top of both images that is transparent an...
Hi!
I have a page with a checkbox that is set to checked when the page is loaded. If/when the checkbox is unchecked I need to run a function. The following code works fine in all browsers with the exception of IE. In versions 7 and 8(haven't even tested 6) it works but you are required to uncheck it, check it, then on the second uncheck...
Hi Everyone!
I'm attempting to create a div tag and then alter it via css, but for some reason its not working here's my code:
$('#draw').click(function(e){
var divToAdd = "<div id='box' style='display:block;background-color:red;width:100px;height:100px'></div>";
$("#area").append(divToAdd);
});
$('#left').click(function(e){
//va...
Hi, I have an idea for a web application where a user can submit Javascript code that can then be served up to other users. I'm wondering what's the best way of going about this. Is it possible to store the Javascript in a database and then serve it up to users as they request it? I would also like to be able to attach metadata to eac...
I'm writing some javascript using jQuery to call a method on all nodes with class datepicker.
Here's what I have:
$('.datepicker').my_method();
This works as expected - it calls my_method.
However, I want to be able to call my_method on all new nodes that are inserted into the DOM with the class datepicker.
I want similar functiona...
Hi all! :-)
i have a simple question.
for a website, i want to create an "info note" that appears by hovering a link, as facebook does when hovering some thumbnails you know?
here is the thing i have for the moment, so you can see the bug i have :
so the only problem is : the small "info note" stay on the left of my div. the goal is ...
I am using the jQuery BBQ: Back Button & Query Library plugin to create a page that pulls in dynamic content when a link is clicked. When the link is clicked the hash is changed and new content is pulled in (the 'default' action of clicking a href is therefore disabled.)
That part works just fine, but there is a problem.
Example of my ...
JSON responses can be exploited by overriding Array constructors or if hostile values are not JavaScript string-escaped.
Let's assume both of those vectors are addressed in the normal way. Google famously traps JSON response direct sourcing by prefixing all JSON with something like:
throw 1; < don't be evil' >
And then the rest of th...
I need to have a user poke at an element on a website, almost exactly like with Firebug as a developer. Does anyone know a simple way to do this in JavaScript, or a library like YUI or jQuery?
...
If there's a better way I am all for it. But I wanna detect a smartphone user on my site.
Whether they be a webOS, Android, or iPhone OS phone. I have a flash video on my site, but when I detect a smartphone users I want it to be a HTML5 video on the site instead.
...