jquery

Jquery find next/prev elements of a certain class but not necessarily siblings

The next, prev, nextAll and prevAll methods are very useful, but not if the elements you are trying to find are not in the same parent element. What I want to do is something like this: <div><span id="click">hello</span></div> <div><p class="find">world></p></div> When the span with the id "click" is pressed, I want to match the next ...

jquery.validate plugin - how to trim values before form validation

I'm using the excellent jquery.validation plugin by Jörn Zaefferer and I was wondering whether there's a easy way to automatically trim form elements before they are validated? The following is a cut down but working example of a form which validates a email address: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:...

JQuery executing onLoad

So I'm trying to execute a function on a component when the page loads. This is what I have so far. $(document).ready(function() { var $foo = $('#data_lost').hide(); $f = function () { doSomething... }; $foo.change($f); }); So this all works fine and dandy. Here's the problem. I also need $f executed on $foo when the ...

jQuery-Ui: Cannot drag object outside of an accordion

I have a draggable object inside of an accordion widget. When dragging it, it's constrained its parent, the accordion element. I've tried to use the 'containment' option with no success. I have tried this with FireFox 3.5.5 and Chromium 4. Is there a way to solve it? Thanks ...

jquery select checkbox by div

I'm wondering if there is a way in jQuery to check/uncheck a checkbox when someone clicks an entire div layer. Like having a massive selection area, essentially. Any ideas? Here is an example... I am trying to make the around the checkbox clickable to toggle the individual checkbox, pretty much. <fieldset> <div> <input ty...

Get a Div Value in JQuery

I have a page containing the following div element: <div id="myDiv" class="myDivClass" style="">Some Value</div> How would I retrieve the value ("Some Value") either through JQuery or through standard JS? I tried: var mb = document.getElementById("myDiv"); But the debugger console shows "mb is null". Just wondering how to retrieve...

jquery - dynamically fill fields with json based on property name

asp.net mvc model object is being fetched by ajax call - $.ajax(.... form has fields with IDs exactly to matching properties on returned json object (created by Html.TextBox("NAME", Model.Order.NAME) ) How to automatically populate fields(inputs) with corresponding json object properties ? Manually would be like $("#NAME).val(json.NAM...

Add fitting List Elements to a new List

Not sure how it is called...maybe you can help me out... I got a lot of Addresses. I want to get an overview and created so called Addressgroups like "My Friends" for example. Some Addresses have multiple Groups. Code works fine. What i need is a way to display all my availble Groups in one List on my Controller. The User must be abl...

jQuery not completely removing draggable/resizable

I'm trying to clone a draggable/resizable element with jQuery. The original element behaves as it should. When I clone it and then try to remove draggable and resizable via the 'destroy' call, it fails to remove the added classes and divs. You can see it in action (or inaction) at the following: jsbin example One of the textareas sho...

Adding jQuery to XMLHttp

How can I add jQuery click events to a page which was loaded with XMLHttpRequest? ...

Disabling JQDialog Resize

For some reason I can't find any documentation in disabling the resize functionality. ...

Apply CSS to jQuery Dialog Buttons

Hello, So I currently have a jQuery dialog with two buttons: Save and Close. I create the dialog using the code below: $dialogDiv.dialog({ autoOpen: false, modal: true, width: 600, resizable: false, buttons: { Cancel: function() { // Cancel code here }, 'Save': function() { // ...

jQuery - Syntax Error

I am using the following to identify the current selected (active) link in a site: $(function(){ var path = location.pathname.substring(1); if ( path ) $('#sidebar_content a[@href$="' + path + '"]').attr('class', 'selected'); }); It appears to identify the path properly but also generates an error Error: uncaught exception: S...

Javascript run-time analysis

Hello, I've written a Javascript file, using jQuery, that I would like to perform run-time tests on. I've never done this before and was just curious on how to go about it. One site I visited suggested this as a measurement: var start = (new Date).getTime(); /* Run a test. */ var diff = (new Date).getTime() - start; This makes sense...

Why does jQuery insist my plain text is not "well-formed"?

I'm making an AJAX call to retrieve some plain text: $.ajax({ url: "programData.txt", type: "GET", dataType: "text", cache: false, success: processData }); When I make the request, though, I get the following error: Error: not well-formed Source File: file:///projects/foo/programData.txt?_=1...

check if jquery has been loaded, then load it if false

Does anyone know how to check if jquery has been loaded (with javascript) then load it if it hasnt been loaded. something like if(!jQuery) { //load jquery file } ...

multiple document.ready()'s performance metrics

I have several javascript files that during run-time get combined and minified. This is for an enterprise application with 10+ developers. There are document.ready functions all over the place causing 5+ second javascript load. I'd like more help in figuring out where the bottlenecks are by slowly removing pieces of functionality. E.g. ...

hide text but not input inside a label jquery

i have a label and input outputted from the shopping cart we are using. i dont want to hack the core of the cart to change the way it outputs. so the code is thus with the input inside the label: <div id="FormField_29" class="FormField"> <label for="FormField_29_0"><input type="checkbox" id="FormField_29_0" name="FormField[2][29][0]...

What is the best way to process multiple transactions one at a time using ajax calls?

Note: Sorry for the amount of pseudo code below, but I didn't know how else to show what I'm trying. There is actually a lot more code than that in my solution that manages ajax icon's and status, but I've dumbed it down to show the root of my problem. Basically, I'm trying to create a process loop on a web page and I'm finding it to be...

Change content of jQuery carousel dynamically

I am trying to do something similar to this: http://www.amazon.com/Black-Friday-After-Thanksgiving-Sale/b/ref=nav_swm_thd?ie=UTF8&amp;node=384082011&amp;pf_rd_p=499992511&amp;pf_rd_s=nav-sitewide-msg&amp;pf_rd_t=4201&amp;pf_rd_i=navbar-4201&amp;pf_rd_m=ATVPDKIKX0DER&amp;pf_rd_r=0642T42GTS6J8H2JKMEF If the link does not work, go on Amazo...