Function “remembers” value problem

This is a simplified partial version of my code to demonstrate the issue: function testFunc(){ var randomNum = Math.floor( Math.random() * 100 ); if( !flag ){ addEvents(); flag = true; }; function checkNumber(){ alert(randomNum) } function addEvents(){ $(“#someElement”).click(function(e){ checkNumber() }); } } I want to bind the click event only ONCE for this element, but […]

Mapping javascript objects to their ids in an MySQL database

This is a question that I have been pondering for a long time, but didn’t want to ask because I wasn’t sure how to describe it.. I’m still not sure if I can describe it well but here it goes.. I have a web app that allows you to manipulate a bunch of elements on […]

Rich Text Editor with Gmail style spell check

I am after a JavaScript Rich Text Editor that supports highlighting words and triggering events when those highlighted words are clicked, like what Gmail does when in spellcheck mode. I will need to heavily customize any existing solution, so something that is easy to extend would be ideal. Currently I am leaning towards TinyMCE.

Pure CSS Dropdown Menu

I have been working on facebook application and you know on facebook native javascript is not allowed, they have their own implementation FBJS which is troublesome when it comes to creating stuff like menus. Is there any pure CSS dropdown solution without any involvement of javascript (javascript is used in all the solutions i have […]

ASP Form problem

I have an asp form that has a checkbox and dropdown menu. If the checkbox in not selected then I need to make sure the dropdown is either not selected or disabled.

Check for a value in a JSON object

I need to find out if an id occurs in my JSON object, for example: { “requested”: “2009-07-25T14:12:25+01:00”, “channels”: [ {“id”: 1, “name”: “General”, “created”: “2009-07-25 14:00:02”} ] } Specifically I need to check if my id (say, 2) occurs in channels.i.id. How can this be done?

Pausing JavaScript execution for animation of code

I’m having an interesting but difficult problem with my JavaScript code. Basically, I’m trying to create an animation of a simple algorithm using JavaScript (a sorting algorithm, if you’re wondering) for educational reasons. I’ve already got all of the animation code written (using RaphaelJS), and it all works fine. The trouble is getting the animations […]

jQuery Ajax success function returns null?

I use the following the jquery statements to call my php controller function, it gets called but my result is not returned to my success function…. <html> <head> <link rel=”stylesheet” type=”text/css” href=”http://localhost/codeigniter_cup_myth/stylesheets/style.css” /> <link rel=”stylesheet” type=”text/css” href=”http://localhost/codeigniter_cup_myth/stylesheets/calendar.css” /> <link rel=”stylesheet” type=”text/css” href=”http://localhost/codeigniter_cup_myth/stylesheets/date_picker.css” /> <script type=”text/javascript” src=”http://localhost/codeigniter_cup_myth/javascript/jquery1.4.2.js”></script> <script type=”text/javascript” src=”http://localhost/codeigniter_cup_myth/javascript/jquery.pagination.js”></script> <script type=”text/javascript”> $(document).ready(function() { getRecordspage(); }); […]

How to disable AJAX-y links before page Javascript ready to handle them?

I am implementing a shopping cart for my website, using a pseudo-AJAX Lightbox-esque effect. (It doesn’t actually call the server between requests — everything is just Prototype magic to update the displayed values.) There is also semi-graceful fallback behavior for users without Javascript: if they click add to cart they get taken to an (offsite, […]

Javascript hide/show classes with checkbox

I am just learning javascript, so please bear with me! I want to be able to use checkboxes to choose to hide/show div classes (to basically filter the amount of info being shown). It is done in this… but I’m try to figure out something much simpler (since I don’t need to dynamically generate the […]