javascript

Keeping key value pairs together in HTML <select/> with JQuery?

Given a select with multiple option's in JQuery. $select = $("<select></select>"); $select.append("<option>Jason</option>") //Key = 1 .append("<option>John</option>") //Key = 32 .append("<option>Paul</option>") //Key = 423 How should the key be stored and retrieved? The ID may be an OK place but would not be guaranteed...

Where can I learn jQuery? Is it worth it?

Hey, I've had a lot of good experiences learning about web development on w3schools.com. It's hit or miss, I know, but the PHP and CSS sections specifically have proven very useful for reference. Anyway, I was wondering if there was a similar site for jQuery. I'm interested in learning, but I need it to be online/searchable, so I can re...

ASP.NET JavaScript Callbacks Without Full PostBacks?

I'm about to start a fairly Ajax heavy feature in my company's application. What I need to do is make an Ajax callback every few minutes a user has been on the page. I don't need to do any DOM updates before, after, or during the callbacks. I don't need any information from the page, just from a site cookie which should always be sen...

Detecting an undefined object property in JavaScript

What's the best way of checking if an object property in JavaScript is undefined? Sorry, I initially said variable rather than object property. I believe the same == undefined approach doesn't work there. ...

Is there a library for rendering basic flow diagrams in Javascript/CSS?

On a web page I want to dynamically render very basic flow diagrams, i.e. a few boxes joined by lines. Ideally the user could then click on one of these boxes (DIVs?) and be taken to a different page. Resorting to Flash seems like an overkill. Is anyone aware of any client-side (i.e. server agnostic) Javascript or CSS library/technique t...

Best javascript compressor

What is the the best Javascript compressor available? I'm looking for a tool that: Easy to use High compression rate Reliable end results (doesn't mess up the code) ...

Javascript Browser Quirks - array.Length

Code: <html xmlns="http://www.w3.org/1999/xhtml"&gt; <head> <title>Unusual Array Lengths!</title> <script type="text/javascript"> var arrayList = new Array(); arrayList = [1, 2, 3, 4, 5, ]; alert(arrayList.length); </script> </head> <body> </body> </html> Notice the extra comma in the array declar...

SimpleModal breaks ASP.Net Postbacks

I'm using jQuery and SimpleModal in an ASP.Net project to make some nice dialogs for a web app. Unfortunately, any buttons in a modal dialog can no longer execute their postbacks, which is not really acceptable. There is one source I've found with a workaround, but for the life of me I can't get it to work, mostly because I am not full...

Is obfuscator Javascript enough?

I'm working on building a development tool that is written in Javascript. This will not be an open source project and will be sold (hopefully) as a commercial product. I'm evaluating the best way to protect my investment. Is using an obfuscator (code mangler) enough to reasonably secure the code? Are there other alternatives that I am...

How to Maintain Correct Javascript Event After Using cloneNode(true)

I have a form element that contains multiple lines of inputs. Think of each line as attributes of a new object that I want to create in my web application. And, I want to be able to create multiple new objects in one HTTP POST. I'm using Javascript's built-in cloneNode(true) method to clone each line. The problem is that each input-lin...

Suppress NTLM dialog box after unauthorized request

In a recent sharepoint project, I implemented an authentication webpart which should replace the NTLM authentication dialog box. It works fine as long as the user provides valid credentials. Whenever the user provides invalid credentials, the NTLM dialog box pops up in Internet Explorer. My javscript code which does the authentication v...

How do I get the coordinates of the caret in text boxes?

I am using jQuery and trying to find a cross browser way to get the pixel coordinates of the caret in text areas and input boxes such that I can place an absolutely positioned div around this location ? Is there some jQuery plugin? or javascript snippet to do just that ? ...

How to keep the browser history in sync when using Ajax?

I'm writing a simple photo album app using ASP.NET Ajax. The app uses async Ajax calls to pre-load the next photo in the album, without changing the URL in the browser. The problem is that when the user clicks the back button in the browser, the app doesn't go back to the previous photo, instead, it navigates to the home page of the app...

How to submit a form when the return key is pressed?

Can someone please tell me how to submit an HTML form when the return key is pressed and if there are no buttons in the form? The submit button is not there. I am using a custom div instead of that. ...

How do I fire an event when a iframe has finished loading in jQuery?

I have to load a pdf within a page (don't ask...) Ideally I would like to have a loading animated gif which is replaced once the pdf is loaded. Thanks ...

JavaScript and Threads

Is there some way to do multi-threading in JavaScript? ...

PHP and JavaScript regex

After my webform is submitted, regex will be applied to user input on the server side (via PHP). I'd like to have the identical regex running in real-time on the client side to show the user what the real input will be. This will be pretty much the same as the Preview section on the Ask Question pages on StackOverflow except with PHP on ...

Is there a html opposite to noscript

Is there a tag in html that will only display its content if JavaScript is enabled? I know noscript works the opposite way around, displaying its html content when JavaScript is turned off. but I would like to only display a form on a site if JavaScript is available, telling them why they cant use the form if they don't have it. The onl...

Dynamically display Edit Control Block menu item in SharePoint

I am trying to set up dynamic per-item menus (Edit Control Block) in SharePoint 2007. My goal is to have certain features that are available based on the current user's group membership. I know that the CustomAction tag that controls the creation of this menu item has a Rights attribute. The problem that I have with this is that the g...

What does this javascript error mean? Permission denied to call method to Location.toString

This error just started popping up all over our site. Permission denied to call method to Location.toString I'm seeing google posts that suggest that this is related to flash and our crossdomain.xml. What caused this to occur and how do you fix? ...