javascript

Most elegant way to force a TEXTAREA element to line-wrap, *regardless* of whitespace

Html Textarea elements only wrap when they reach a space or tab character. This is fine, until the user types a looooooooooooooooooooooong enough word. I'm looking for a way to strictly enforce line breaks (eg.: even if it results in "loooooooooooo \n ooooooooooong"). The best I've found is to add a zero-width unicode space after ever...

Using core JQuery, how do you remove all the options of a select box, then add one option and select it?

My select box is the following <Select id="mySelect" size="9" </Select> thanks EDIT: This answer was helpful with chaining...however (in IE) .val('whatever') did not select the option that was added. (I did use the same 'value' in both .append and .val) $('#mySelect').find('option').remove().end().append('<option value="whatever">te...

Combining and Caching multiple JavaScript files in ASP.net

Either I had a bad dream recently or I am just too stupid to google, but I remember that someone somewhere wrote that ASP.net has a Function which allows "merging" multiple JavaScript files automatically and only delivering one file to the client, thus reducing the number of HTTP Requests. Server Side, you still kept all the individual ...

JQuery & Objects, trying to make a lightweight widget

Trying to make a make generic select "control" that I can dynamically add elements to, but I am having trouble getting functions to work right. This is what I started with. $select = $("<select></select>"); $select.addOption = function(value,text){ $(this).append($("<option></option>").val(value).text(text)); }; This worked fine al...

Getting the ID of the element that fired an event using JQuery

Is there any way to get the ID of the element that fires an event? I'm thinking something like: <html> <head> <script type="text/javascript" src="starterkit/jquery.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("a").click( function(){ var test = caller.id; ...

Am I allowed to run a javascript runtime (like v8) on the iPhone?

According to this discussion, the iphone agreement says that it doesn't allow "loading of plugins or running interpreted code that has been downloaded". Technically, I would like to download scripts from our server (embedded in a proprietary protocol). Does this mean I wouldn't be allowed to run a runtime like v8 in an iphone app? Thi...

problem with dojo dijit.form.ValidationTextBox

The following xhtml code is not working: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt; <html xmlns="http://www.w3.org/1999/xhtml"&gt; <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link rel="stylesheet" type="text/css" href="/dojo...

Best javascript i18n techniques / AJAX - dates, times, numbers, currency

For server side generated content, i18n support is usually pretty easy, for example, Java provides extensive i18n support. But, these rich server side libraries are not available within the browser, which causes a problem when trying to format data client side (AJAX style.) What javascript libraries and techniques are recommended for p...

Javascript make the web broswer srcoll to the top?

What is the Javascript to scroll to the top when a button/link/etc. . . clicked? ...

How to read bound hover callback functions in jquery

I used jquery to set hover callbacks for elements on my page. I'm now writing a module which needs to temporarily set new hover behavior for some elements. The new module has no access to the original code for the hover functions. I want to store the old hover functions before I set new ones so I can restore them when finished with the ...

Linking combo box (JQuery preferrably)

Hi, I am wondering if anyone has any experience using a JQuery plugin that converts a html <select> <option> Blah </option> </select> combo box into something (probably a div) where selecting an item acts the same as clicking a link. I guess you could probably use javascript to handle a selection event (my javascript knowledge is a...

Getting DIV id based on x & y position

The problem I'm trying to solve is "What's at this position?" It's fairly trivial to get the x/y position (offset) of a DIV, but what about the reverse? How do I get the id of a DIV (or any element) given an x/y position? ...

GreaseMonkey script to auto login using HTTP authentication

I've got quite a few GreaseMonkey scripts that I wrote at my work which automatically log me into the internal sites we have here. I've managed to write a script for nearly each one of these sites except for our time sheet application, which uses HTTP authentication. Is there a way I can use GreaseMonkey to log me into this site auto...

Trigger UpdatePanel on mouse over (as tooltip)

I need to display aditional information, like a tooltip, but it's a lot of info (about 500 - 600 characters) on the items in a RadioButtonList. I now trigger the update on a PanelUpdate when the user selects an item in the RadioButtonList,using OnSelectedIndexChanged and AutoPostBack. What I would like to do, is trigger this on onMouse...

How to implement file upload progress bar on web?

I would like display something more meaningful that animated gif while users upload file to my web application. What possibilities do I have? Edit: I am using .Net but I don't mind if somebody shows me platform agnostic version. ...

Binding custom functions to DOM events in prototype?

Jquery has a great language construct that looks like this: $(document).ready(function() { $("a").click(function() { alert("Hello world!"); }); }); As you might guess this, once the document has loaded, binds a custom function to the onClick event of all a tags. The question is, how can I achieve this same kind of beh...

problems with mouseout event

I'm using javascript to hide an image and show some text thats hidden under it. But, when the text is shown if you scroll over it, it fires the mouseout event on the container, that then hides the text and shows the image again, and it just goes into a weird loop. The html looks like this <div onmouseover="jsHoverIn('1')" onmouseout="j...

Anyone know of Objective-J syntax highlighting in vi?

I have been looking at the new Objective-J / Cappuccino javascript framework from 280North. They provide plug-ins for SubEthaEdit and TextMate to handle syntax highlighting, but I primarily use vi. Does anyone know of a way to get Objective-J syntax highlighting in vi, or a good way to convert whatever format the other two editors use?...

How do I get a result from a modal dialog in JQuery

I would like to use an add-in like simplemodal or the dialog add-in in the UI kit. However, how do I use these or any other and get a result back. Basically I want the modal to do some ajaxy interaction with the server and return the result for the calling code to do some stuff with. Thanks. ...

Using shadowbox disables keyboard shortcuts?

So my site uses shadowbox (http://mjijackson.com/shadowbox/) to do display some dynamic text. Problem is I need the user to be able to copy and paste that text. Right-clicking and selecting copy works but ctrl+c doesn't (no keyboard shortcuts do) and most people use Ctrl+c right? You can see an example of what I'm talking about here: ...