jquery

Firefox extension with jquery 1.3+

I use jquery-1.2.6 within my Firefox extensions and it works great. Some days ago i wanted to update to the current version of jquery (1.31) but this does not seem to work anymore. Here is my technique to include jquery in my extensions: $mb = jQuery.noConflict(); var doc = window.content.document $mb("body", doc).slideToggle("slow"); ...

jquery ui css newbie question

I just for the first time downloaded jquery and jquery-ui to use/learn last night. I figured out how to get it working, and now I am playing around with the downloadable/customizable themes on themeroller...(nice tool). A question about best way of maximizing the use of these tools: I am integrating query/jqueryUI into an existing asp...

Misuse of the CSS class attribute, or valid design pattern?

As you most likely already know, it's simple in JQuery to select all elements in the document that have a specific CSS class, and then, using chaining, assign common event handlers to the selected elements: $(".toolWindow").click(toolWindow_click); $(".toolWindow").keypress(toolWindow_keypress); As usual the class "toolWindow" is also...

Chaining JQuery animations through iteration

I have a number of divs next to each other (horizontally) and want the width of each of them, sequentially. Ideally they should look like one long div that grows to the right from the left. My issue is that they all start growing simultaneously. Each div has the name 'div' with a number at the end, and I'm using 'i' as that number. T...

jQuery click event for document but ignore a div

I have a online Slide Show I'm working on using jQuery. I have use $(document).click event to detect when a user clicks on the page to know when to show the next bullet point in the slide or to move to the next page. The problem I'm running into is my job had me insert a comment box on the bottom of the page and when ever someone clicks...

Why does my event handler cause an "is not a function" error, but works from the Firebug console?

Using JQuery 1.2.6, testing from Firefox 3 and IE7. I have a very basic bit of JavaScript to reload a captcha image. In my JS file, I have: var Captcha = { count: 0, Refresh: function(){ // Concatenate "count" to force a URL change, which forces the browser to reload the image $('#Captcha').attr('src', 'Captch...

Do you have any security concerns when it comes to JQuery plugins?

Hello all, I am curious as to what, if any, security concerns other develpers have in regards to the use of JQuery plugins. I have seen very little talk about security where JQuery is concerned. Is it really a non issue? Appreciate your thoughts! ...

Asp.Net MVC. Updating user control (Shopping Cart) with Ajax

I want to implement a user control which represents a list of the current items in a user's shopping cart, and which is included from within the a master page. I want to add a product to the shopping cart; the shopping cart should be automatically updated with an asynchronous call (JavaScript framework is jQuery) when a user adds a prod...

.getJSON produce a Download of a File ASP.NET MVC

I code a .getJSon, It does the job but I get IE to asked to download the file. Here is the code <script type="text/javascript"> $(function() { $('#id').click(function() { var dateReport = "01/01/2009"; $.getJSON('/Report/SendReport', { date: dateReport}, function(response) { if (r...

JavaScript/jQuery - offsetLeft and offsetTop

When hovering over a span I would like to get the offsetLeft and offsetTop values so I can make something hover near it. When I do this I get 0 for both values. What is a better way to tackle this? I am using jQuery. Assume I am starting with (looped by server-side scripting): <span onmouseover="hoverNearMe(this.offsetLeft,this.offs...

How can I simplify this Javascript function?

I'm trying to scale this but I'm a little green when it comes to creating JS functions. I managed to get this far on my own, but alas... When a span gets a value of whatever (in this case, a city name), I want the select box to automatically match it. And I want to scale this by getting rid of all these else if's. $(document).ready(fun...

jQuery dialog that darkens the screen like the link dialog does here

I like the look of the link dialog here. It darkens the screen and is probably modal (although I haven't tested that I just assume it is). What's a quick and easy way of darkening the screen like that witha jQuery UI Dialog? ...

replacing or managing json data from ajax request

I've got a page that makes an ajax request and gets data back in json format. I needed to sort this data before adding it to the DOM, so it is put into an object with the following code function(data){ var birthDates={}; var uids={}; $.each(data.users, function(){ if(!uids[this.uid]){ ...

Numeric Dropdown that 'turns into' a textbox when I select 'More'

I need to make a dropdown that has the numbers 0 through 10 in it, plus a "--More--" option at the bottom. If the user selects '--More--' then I want the dropdown to 'turn into' a textbox so they can enter a numeric value. I want the field name posted back to have the same form value regardless of which entry method was used. Preferably...

JQuery , set attribute for <a> tag

i am use $(expr).attr("hash",value) to set a "hash" attribute for HTML anchor element "a" but the Jquery would not do that. but if i change expr to "div", then i can set "hash" attribute to "div" tag. is this behavior a xhtml specification? i can set "id" of "a" tag attribute. since id is a built in attribute for html "a" tag. ...

jQuery ajax method using a callback to update an elements class

Hi, I want to fire a function when an image is clicked, and that function will hit a URL passing it a parameter and then update the containing div's class with the value I get back from the URL. Can someone help me with code for this? My DOM looks like: <div class="c1"><img src="/images/hello.jpg"/></div> My URL is http://www.examp...

jQuery dialog not working after server-side redirect

I have an ASP.NET website which uses the jQuery dialog to present the user with a downloads terms dialog. Once the user has agreed to the terms in the dialog, the I perform a server-side postback which issues a Response.Redirect call to a page on another website which is responsible for serving the download to the browser. The problem is...

Expand list with slideToggle

Hi. I have an unordered list like this one: <a href="#" id="myList-toggle">Show the rest</a> <ul id="myList"> <li>Item 1</li> <li>Item 2</li> <li>Item 3</li> <li>Item 4</li> <li>Item 5</li> <li>Item 6</li> <li>Item 7</li> <li>Item 8</li> <li>Item 9</li> <li>Item 10</li> </ul> and this jQuery code: var list = $('#myList li:gt(4...

'Destination DIV' disappearing in simple jQuery AJAX call

Edit: Important: It is extremely unlikely that anybody who has come across this will have the exact same problem as me - check my answer below for my very obscure solution. There were however some useful responses that may apply to other's situations. Good luck if you're having a similar problem. I've got a really simple jQuery AJAX c...

jquery getJson not passing any values to controller

I am trying to pass some text from a textbox to a controller to get JSON results like so function invokeAction() { var searchText = $("#SearchTextBox").val(); // Invoke MVC controller action $.getJSON("/Home/Results/" + searchText, bindResults); } If I put an alert here I can see that searchText definately...