jquery

Interview Questions for an Intern

I have a potential intern coming in tomorrow for his second interview. Following Joel Spolsky's advice from "Smart & Get Things Done" this is where we get a little technical and make sure the kid can do the things he says he can do. We are a ASP.NET, C# (1.1 - 3.5) shop that uses XHTML/CSS, jQuery, SQL Server 2000/2005 primarily for ou...

Wrapping lists into columns

I'm using ClodFusion(sic) to populate a template that includes HTML lists (<ul>'s). Most of these aren't that long, but a few have ridiculously long lengths and could really stand to be in 2-3 columns. Is there an HTML, ColdFusion or perhaps JavaScript (I have jQuery available) way to do this easily? It's not worth some over-complicat...

Graph visualization code in javascript?

Hi. I have a data structure that represents a directed graph, and I want to render that dynamically on an HTML page. Does anyone know of any javascript code that can do a reasonable job with graph layout? These graphs will usually be just a few nodes, maybe ten at the very upper end, so my guess is that performance isn't going to be a bi...

How do I add a pre tag inside a code tag with jQuery?

I'm trying to use jQuery to format code blocks, specifically to add a <pre> tag inside the <code> tag: $(document).ready(function() { $("code").wrapInner("<pre></pre>"); }); Firefox applies the formatting correctly, but IE puts the entire code block on one line. If I add an alert alert($("code").html()); I see that IE has inserte...

Scrolling Overflowed DIVs with JavaScript

I've got a div that uses overflow:auto to keep the contents inside the div as it is resized and dragged around the page. I'm using some ajax to retrieve lines of text from the server, then append them to the end of the div, so the content is growing downwards. Every time this happens, I'd like to use JS to scroll the div to the bottom so...

Dynamic Alphabetical Navigation

I'm using ColdFusion to return a result set from a SQL database and turn it into a list. I need some way to generate an Alphabetical Navigation bar for that list. I have ColdFusion and the jQuery library available. I'm looking to generate something like this: A | B | C | ... A A B B B C D Where clicking on one of the letters ...

What's the best way to code a desktop application-like menu bar in Javascript?

I'm looking to create a menu bar similar to those found in desktop applications using xhtml and javascript. I don't mind using a framework like jQuery (in fact I'm already using jQuery for other behaviour in the app), but I'd like to avoid using a plugin or an external js solution (the idea is to keep it as light and as tightly-controll...

jQuery AJAX vs. UpdatePanel

We've got a page with a ton of jQuery (approximately 2000 lines) that we want to trim down b/c it is a maintenance nightmare, and it might be easier to maintain on the server. We've thought about using UpdatePanel for this. However, we don't like the fact that the UpdatePanel is sending the whole page back to the server. Looking for...

Escaping HTML strings with jQuery

Does anyone know of an easy way to escape HTML from strings in jQuery? I need to be able to pass an arbitrary string and have it properly escaped for display in an HTML page (preventing JavaScript/HTML injection attacks). I'm sure it's possible to extend jQuery to do this, but I don't know enough about the framework at the moment to ac...

What is a selector engine?

I've seen news of John Resig's fast new selector engine named Sizzle pop up in quite a few places, but I don't know what a selector engine is, nor have any of the articles given an explanation of what it is. I know Resig is the creator of jQuery, and that Sizzle is something in Javascript, but beyond that I don't know what it is. So, wh...

How to set encoding in .getJSON JQuery

In my web app, i submit some form fields with JQuery $.getJSON() Method. I am having some problems with the encoding. The character-set of my app is charset=ISO-8859-1 but i think this fields are submitted with UTF-8. Does anyone know, how can i set encoding in $.getJSON calls? ...

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...

Where is the best jQuery "plugins" library on the web?

Where is the best jQuery "plugins" library on the web? ...

How would you handle errors when using jQuery.ajax() ?

When using jQuery's ajax method to submit form data, what is the best way to handle errors? This is an example of what a call might look like: $.ajax({ url: "userCreation.ashx", data: { u:userName, p:password, e:email }, type: "POST", beforeSend: function(){disableSubmitButton();}, complete: function(){enableSubmitBu...

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...

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 ? ...

Problems while submitting a UTF-8 form textarea with JQuery/AJAX

I am having problems submitting forms which contain UTF-8 strings with Ajax. I am developing a Struts web application which runs in a tomcat server. This is the environment i set up to work with UTF-8: I have added to tomcat's conf/server.xml the attributes URIEncoding="UTF-8" useBodyEncodingForURI="true" into the Connector tag. I have...

How to compare html entity with JQuery

I have the next html code <h3 id="headerid"><span onclick="expandCollapse('headerid')">&uArr;</span>Header title</h3> I would like to toggle between up arrow and down arrow each time the user clicks the span tag. function expandCollapse(id) { var arrow = $("#"+id+" span").html(); // I have tried with .text() too if(arrow...

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 ...