jquery

Should a animated header be in flash or javascript?

I work at a small website building company and on one of our clients website we have a flash animation in the banner. The animation is rather chunky being 4 megabytes. The client has recently requested a rebuild of the site which would again include an animated header. We were thinking about this time not building the header in flash (or...

jquery value of element

why is this not returning value in li? what am i doing wrong? $("#list li").click(function() { var selected = $(this).val(); alert(selected); }) ...

jQuery - receiving the $_FILES array using $.post

Hello all. I am attempting to submit a form via jQuery. My form contains fields and a file that must be uploaded. It is of type ENCTYPE="multipart/form-data". I can receive all my field values using: post = $('#myForm').serialize(); But how do I receive the $_FILES array? I need this to process the uploaded file. Is this possible usin...

set timeout for jQuery UI draggable() to prevent locking effect

I'm using draggable(), but occasionally the draggable() seems to create a locking effect where the dragging effect persists even after the mouse button is released. Once this happens, the only fix is to refresh the page, which is a terrible way to go for an ajax-based site. So using the UI docs I'm trying to figure out a way to set a ti...

Django templates: insert values for javascript variables

I am trying to assign some javascript variables in a Django template. I am having a problem where the values I am assigning are being written to the page properly (I can see them in the page source), but still come up as null. I am doing this: <script type="text/javascript"> var coords = []; {% for i in item_list %} coords.pus...

Using the context of the 'this' keyword with jQuery

As a jQuery neophyte I am somewhat confused by the different contexts in which the this keyword is used. Sometimes it refers to a DOM element e.g. this.id and sometimes it refers to a jQuery object e.g. $(this).val(). Remy Sharp's blog post is helpful but I would like to know how you would explain the difference to a novice. Is the di...

Jquery toggle on window minimize.

I have a div that toggles in and out of display when you click on another div. How could I modify my code so that when the user minimizes the whole browser window it automatically toggles, hiding the div from view so when the user un-minimizes window the div is no longer visible. ...

Finding matched classname in jQuery

I have a series of image thumbnails in a page. They are created using css sprites. <div class="galleryImg1"></div> <div class="galleryImg2 featured"></div> <div class="galleryImg3"></div> I was originally using id="galleryImg1" but changed to using class="galleryImg1" because the images may appear in multiple places on the same page a...

Sort <div> elements using jQuery

I have HTML like the following on my website: <div class="groups"> <div class="group"> Group 1 priority: <select> <option value="1.0">1</option> <option value="2.0" selected="selected">2</option> <option value="3.0">3</option> </select> </div> <div class="group"> Group 2 priority: <select> ...

How can I make my jquery draggable / droppable code faster?

Hi, I've used JQuery to make the elements in a table draggable. (I've never used JQuery before this). It works fine, but is very slow. For example, from the moment I click and hold on an item, to the moment the cursor changes is about 2 seconds. This is on Firefox 3.0.6. Once the item is being dragged, there's a shorter, but still notic...

Add an element to a jquery object

I've got a cached jquery object setup like this var comments = $('li.comment'); When creating new elements, is there an easy way to update the comments objects instead of redfining it? I'm looking fot something like comments += $('li.newcomment'); Is this possible? ...

jQuery Animation Help

I have a dynamic amount of div's being returned from a query, all with the class #li. I want them all to fade in smoothly instead of just appear. So far I'm using this code: function loadTables() { $.get("display.php", { server: Server, username: Username, password: Password, database: Database, content: "tables" }, funct...

jquery href returns undefined

I have this in my HTML <a class="deleteLink" href="system/id">link</a> Then using jQuery, I run this in $(document.ready(function() alert($("a.deleteLink").attr("href")); Which shows system/id But running this: alert($("a.deleteLink").href); Shows undefined If I add an Id to the a tag like this <a id="myId" class="deleteLink"...

jQuery "fadeOut" & "remove"

Hi I'm trying to give a fadeout & delete to a DIV(id = "notification"), when a image is clicked. This is how I'm doing that: <a onclick="$("#notification").fadeOut(300,function() { $("#notification").remove(); });" class="notificationClose "><img src="close.png"/></a> This seems to not be working. What I need to do to fix this? Than...

jQuery AJAX Character Encoding Problem

Hi everyone, I'm currently coding a French website. There's a schedule page, where a link on the side can be used to load another day's schedule. http://aquate.us/film/horaire.html (At the moment, only the links for November 13th and November 14th work) Here's the JS I'm using to do this: <script type="text/javascript"> function l...

jQuery selector context question

Hello, I'm trying to do make the following selection: $(".program", row) Where "row" is a jQuery object containing two table rows. One of the tr's has the class 'program". This selector doesn't seem to find it. However the following works: $(".title", row) where div.title is a descendant of tr.program. If I use a jQuery object ...

consecutive, not concurrent jQuery AJAX posts

I'm probably missing something obvious, but I don't seem to be able to get my AJAX posts to run consecutively instead of concurrently with jQuery. ad_numbers is an array of numeric IDs. $(ad_numbers).each(function() { ad_number = $.trim(this); if(!ad_number) { return true; } $.post('/fetch.php', { ad_number: ad_number }, functi...

Changing the img src using jQuery

Hi, My DOM looks like this: <div id="d1"> <div class="c1"> <a href="#"><img src="img1_on.gif"></a> <a href="#"><img src="img2_on.gif"></a> </div> </div> When anyone clicks on an image, I want the image src to change to where x represents the image number 1 or 2. Is this possible or do I have to use CSS...

Loading all objects with class into an array using jQuery

Hi, I have a bunch of div's on my page with class testClass. I want to load them into an array and then check the array's size. But its not working? myArray = $('testClass'); alert(myArray.count); What's wrong? ...

How do I add a custom item to the top of a dropdown using the asp.net mvc Html.DropDownList helper?

I have a dropdown list on my asp.net mvc site: <%= Html.DropDownList("CustCodes") %> My controller: ICallService sc = new CallService(); IList<CustCode> custCodes = sc.GetCustCodes(); ViewData["CustCodes"] = new SelectList(custCodes, "ID", "Name"); What I want is once the dropdown is displayed to either have a blank entry at...