jquery

What's the cleanest way to trigger a JS loading message during ajax page requests in RoR

Hello, I am building a new application in Rails 3 and want to implement a "Loading" message that is displayed when an ajax request is fired off and hidden when the response comes back. I would like to keep it DRY and only specify this functionality in one place, with the ability to override the functionality selectively (for instance, ...

jQuery Sortable linked lists spilling outside container as they expand?

This I'm assuming is a relatively trivial problem. I have two connected sortable lists, each inside a seperate fixed DIV. I have the DIVs set to overflow:scroll-y. As I add LI objects to a list, instead of the expected behaviour (expected by me) of a scroll bar appearing and the bottom of the list being neatly hidden, the list spills ...

Calling a javacript function through micro template

Hi, I am using the micro template (Micro Template) in my project. Below is the sample <script type="text/html" id="user_tmpl"> <% for ( var i = 0; i < users.length; i++ ) { %> <li><a href="<%=users[i].url%>"><%=users[i].name%></a></li> <% } %> </script> Is it possible to call a javascript function say a simple function like t...

jquery time ago with unix epoch

Hi, I'm using django currently and outputting the date in seconds from the unix epoch. How do I use jquery time ago with unix epoch? I see this example: January 10, 2015 <abbr class="timeago" title="2015-01-10T15:00:00Z">January 10, 2015</abbr> but can i do something like: <abbr class="timeago" title="2015-01-10T15:00:00Z">{{UNI...

jQuery.load gives me a 404 Not Found in WPMU

I've developed a plugin that works fine on a single site WP. But when testing it on WPMU with subdomain, I get a 404 Not Found error. The strange thing is that the content is loaded even though I get the error message - but the content is never displayed. You can see a screenshot here: http://www.stiengenterprises.com/download/tmp/jQue...

How do I remove trailing white spaces but not white spaces within a string (nor at the beginning)?

I have a string of varying length and is usually followed by white spaces (of varying length based on he string). i.e. - the string is always 20 characters long var data = "DUR IT R4356 " //with 8 trailing or the string could be var data = "11& 444 DTF# 5676 " //with 3 trailing What is the best way to get rid of those tra...

jquery click event from a checkbox not working as expected.

I have a few checkboxes on my form. I would like to run a bit of javascript when someone clicks them. I've tried the following code after much head scratching and have no idea why its not working. $().ready(function () { $('#uploadDirs').find(':checkbox').each(function () { $(this).attr('onClick', "alert('hello');"); ...

How do I grab status updates from a facebook group?

I'm making a website for a organization that also has a facebook group, and keeps it pretty up to date.... So, I was wondering if there was a way to pull the 5 most recent posts. =\ ...

How to create a detachable toolbar kind of thing

I am developing a web based application where I need to have a detachable toolbar kind of thing. This way user would be able to move the toolbar to somewhere else in the browser while working. A site already has this kind of functionality. Here is a snapshot http://skitch.com/neerajdotname/dai12/neeraj-singh-flavors.me What jQuery plu...

Executing JS in dynamically loaded content

Hi All,   I've started working on a project that loads all of the different pages content dynamically. On the surface this seems simple enough, an AJAX call to a script that returns the content that is placed inside a DIV. Except that not only HTML but JS is returned as well. I'm seeing a lot of things like this:- <img src="spacer.gif"...

Jquery - bind/unbind hover script, small bit of code, not sure what to do.

I've created DIV.cb-toggle, when the user hovers over this div, it animates to Orange, when they hover off of this div, it animates back to gray, when the user clicks this div, it animates to blue, telling the user that it's been selected. So when it's NOT selected, it has mouseenter mouseleave animations, but when it's selected i want t...

Constructing the url dynamically

I have this site that I am currently working on which is jQuery heavy and I have another challenge that I have encountered. The links on the top on the page * Standard Class * Bussiness Class * Premium These links are not working currently because i have not implemented them yet but i have a problem with the url. This is how I am...

jquery value substitution

Is this a ligitimate way of determining the selected value of an section/option box with and id of "shirt_size_1221"? var user_id = '1221'; x = "#shirt_size_" + user_id ; alert($(x + " option:selected")); ...

Best way to insert hundreds of DOM elements into the page dynamically while keeping performance high

I have a web app where we would be inserting hundreds of elements into the DOM Essentially, I'm doing $('#some_element').html('<lots of html here>'); repeatedly. In some cases I might need to do $('#some_element').appendTo('more html'); From previous experience inserting html text using the append or setting the innerHTML of an ...

Validate date between multiple dates in jQuery.validate and datepicker

Hi, I'm using jQuery.datepicker and jQuery.validate. In my form I have multiple date ranges: 2010-02-10 - 2010-02-18 2010-03-01 - 2010-03-12 2010-03-15 - 2010-03-19 etc. Now I need to validate the datepicker field to check if the date set in the datepicker is between any of those date ranges. For instance 2010-01-01 would be invali...

IE6/7 Freezing during jQuery AJAX request

I'm using the following code to call in some html, and display it. Most browsers seem to handle it fine, but IE6 and 7 freeze up. Unfortunately, the request can sometimes take more than a few seconds, so the delay is noticeable. I'm also calling Fancybox on success, so that the returned html can have a link that launches a modal window....

select a child element in jquery object

Hi, I'm new to jquery and I have a basic question now. I have a jquery object got from a jquery selector. e.g var obj = $('#certainTR'); Now, I want to get the element in this object and I cannot use '#certainTR > date' in a selector because '#certain' is not passed in my subroutine. Is there anyway to make a selection base on a obj...

Javascript array, Parse each element multiply each element by 'x'

How do I parse through an array and for each element multiply its value field by 'x' I want to pass through a a native array that contains 60 elements as follows: [ [value, key], [value, key], [value, key] ] In the above example the key field will be a number starting at 60 and counting down to 0. The value field can be any nu...

AJAX autocomplete with jQuery in a Ruby on Rails 3 application

I would like to implement an AJAX "autocomplete search" feature of my Ruby on Rails 3 application. I would like to use jQuery to implement the JavaScript portion. Is there a popular approach (or tutorial) to implement this? ...

Suggestion needed for NON JavaScript version of an input autocomplete

I'm building an App that is heavy on jQuery. Most of it I can handle without the use of JS and still have a functioning site, however there is one bit that is eluding me. (note, I'm using ASP.NET MVC but that shouldn't matter in this instance) I have an input field that is making great use of jQuery-UI AutoComplete. The behavior is ver...