jquery

jQuery get select option text

Alright, say I have this: <select id='list'> <option value='1'>Option A</option> <option value='2'>Option B</option> <option value='3'>Option C</option> </select> What would the selector look like if I wanted to get "Option B" when I have the value '2'. Please note that this is not asking how to get the selected text value, but just a...

How to check if a file exists in javascript?

I'm using the jquery library to load the content of an html file. Something like this: $("#Main").load("login.html") If the file (in this case 'login.html') does not exist, I would like to detect it so that I can redirect the user to an error page for example. Any ideas how I can detect if the file to load exists or not? ...

Flash Organisation Chart

I've been searching for a library that can render organisation charts in either flash and/or javascript(preferably jQuery). I know of several javascript and/or flash chart libraries but none of them seem to be able to render an organisation chart such as this: http://www.fsai.ie/images/org_chart.gif ...

JQuery drag and drop - how to get at element being dragged

Hi, I am using the JQuery libs to implement drag and drop. How do I get at the element that is being dragged when it is dropped? I want to get the id of the image inside the div. The following element is dragged: I have the standard dropped function from their example $(".drop").droppable({ accept: ".block", ...

Get radio value inside iframe

How do I go about doing this with jQuery? Basically the structure: <form id="myForm"> <iframe> <!-- Normal HTML headers omitted --> <input type=radio name="myRadio" value=1>First <input type=radio name="myRadio" value=2>Second <input type=radio name="myRadio" value=3>Third </iframe> <input type=button value="Submi...

How Do You Use jQuery to Simplify Your MVC Views?

I have found jQuery to be a great tool to simplify my MVC Views. For example, instead of including complicated logic to add alternating styles to my tables I just do this... $(document).ready(function() { $("table.details tr:odd").addClass("detailsAlternatingRow"); $("table.details tr:even").addClass("detailsRow"); ...

JQuery Select Box and Loop Help

Hi All, Thanks for reading. I'm a bit new to jQuery, and am trying to make a script I can include in all my websites to solve a problem that always drives me crazy... The problem: Select boxes with long options get cut off in Internet Explorer. For example, these select boxes: http://discoverfire.com/test/select.php In Firefox they ar...

How do I select a mouse hovered object with JQuery?

I have a list of dynamically generated div-tags with a class-attribute but no id. How do I select the one which is hovered with mouse cursor? In CSS it would be like this: div.classname:hover Oh, and I wouldn't like to use any extra Jquery-plugins. ...

How to manage a redirect request after a JQuery Ajax call

Im using $.post() to call a Servlet using Ajax and then use the resulting HTML fragment to replace a div element in the User's current page. However, if the session timeouts the server sends a redirect directive to send the user to the login page. Nonetheless, JQuery is replacing the div element with the contents of the login page, forci...

JQuery "Any Row" Picker

Hi All, I'm looking for a generic "Row Picker" for JQuery. We've all seen the cool "Picker" tools like date pickers, color pickers, time pickers, etc, where you click in a text box and a little calendar or color palate or clock or something comes up. You select something (like a date) and the text box is then populated with a value. ...

JQuery: Visual studio, error CS1056: Unexpected character '$'

Trying to include ThickBox (from http://jquery.com/demo/thickbox/) in an ASP.NET application. Visual Studio is failing when I try to run the application with the error: js\ThickBox\jquery-1.2.6.min.js(11): error CS1056: Unexpected character '$' Using Visual Studio 2008 and jquery 1.2.6 ...

How to invoke .net page methods from javascript without jquery ?

I've been tryin' to use call Page Methods from my own javascript code but it doesn't work. If I use JQuery AJAX Method I can sucessfully call the Page Methods, but the problem is that I need to do this from my own Javascript code because in the place where I work we can't use Third Party Javascript Lybraries and we are building our own l...

nearest ancestor node in jQuery

In my javascript experience, I found that is a very common task "searching the nearest ancestor of an element with some condition (tag name, class,...)". Can the parents() method of jquery do the job? The order of returned elements of parents() is predictable? Is top-to-bottom or bottom-to-top? For the moment I use this utility functio...

How should I add multiple identical elements to a div with jQuery

I need to add multiple empty divs to a container element using jQuery. At the moment I am generating a string containing the empty html using a loop divstr = '<div></div><div></div>...<div></div>'; and then injecting that into my container: $('#container').html(divstr); Is there a more elegant way to insert multiple, identical ele...

Best jQuery Status Message Plugin?

What is the best jQuery status message plugin? I like jGrowl and Purr, but jGrowl doesn't have the feature to remain sticky (not close automatially) and Purr doesn't seem to work right in IE 6. I would like to show messages like... the site is about to go down for maintenance, your such and such job has completed, and stuff like that. ...

Easy way to turn Javascript array into comma-separated list?

I have a one-dimensional array of strings in Javascript that I'd like to turn into a comma-separated list. Is there a simple way in garden-variety Javascript (or jQuery) to turn that into a comma-separated list? (I know how to iterate through the array and build the string myself by concatenation if that's the only way.) ...

Mixing jQuery and YUI together in an app, is it easily possible?

I have to preface this with the fact that I love jQuery as a JavaScript language extension and YUI as a rich set of free controls. So here is my question, is there going to be any problems down the line if I mix jQuery and YUI together in an MVC app I am working on. I want to use jQuery for the heavy lifting on the DOM and I want to us...

Assigning values to a list of global variables in JavaScript

Hey right now I'm using jQuery and I have some global variables to hold a bit of preloaded ajax stuff (preloaded to make pages come up nice and fast): $.get("content.py?pageName=viewer", function(data) {viewer = data;}); $.get("content.py?pageName=artists", function(data) {artists = data;}); $.get("content.py?pageName=instores"...

How do I set up a timer to prevent overlapping ajax calls?

I have a page where search resuts are shown both in a grid and on a map (using KML generated on the fly, overlaid on an embedded Google map). I've wired this up to work as the user types; here's the skeleton of my code, which works: $(function() { // Wire up search textbox $('input.Search').bind("keyup", update); }); update = f...

jquery table header sort

Anybody know of a plugin, or a built in function to make the columns in a table sortable? i.e. I click on the column header and it sorts the rows by that column? ...