jquery

Is there a standard way to do a docblock for jQuery plugins?

I am wondering if these is any standard for providing a docblock for jQuery plugins. And is it best to show how to pass in the config JSON object and should I explain the defaults? e.g. superPlugin v1.1 @author Me Myself @options something Can anyone provide any links? Thanks UPDATE I've ended up just modifying th...

how to iterate through multiple select options with jquery

I was just wondering if it's possible to go through multiple select options and get their values and text(if one is selected get the value and text, if 2 is selected get both of their values and text and so on) I have 15 select boxes in one page? any help would be appreciated. <form> <select class="select" name="select3" id=...

Custom Error Problem

How i can do this: I generate this error: <td htmlfor="newPassword" generated="true" class="error">Error</td> but i want this: <td htmlfor="newPassword" generated="true" class="error"><span>Error</span></td> How i can add "span" or other tags for "Error" text? ...

Problem selecting radiobuttons with JQuery

I'm having a problem with the following code. Below is my javascript <script type="text/javascript"><!-- function toggleTB(val, targetTB) { var b = 'disabled'; if (val == '1') b = ''; $('#' + targetTB).attr('disabled', b); } my html - <input id="obp17" name="obp17" onclick="toggleTB('0', 'obp4a');" type="checkbox"...

Different action depending on returned content type in jquery ajax

Hi, Is there any way I can evaluate the returned content type of a jquery ajax request and do different things depending on the content type? For example if the conten type is html I'd like to append this to a certain div on my page. If the content type is text/javascript I'd like to just evaluate the javascript. If the content type is...

Best Practices for MVC, jQuery and Handling Errors

Does anyone have a elegant way of dealing with errors in ASP.Net MVC? I constantly run into issues when dealing with requests to controller actions where the Action can be used for both normal requests and AJAX requests. The problem I have is finding an elegant way of dealing with these issues. For example, how could I handle validation...

jQuery Tabs and Ajax - how do I setup the pages?

I've started using jQuery's UI Tabs, and they work great for the most part, but I've had some issues. When I switch back and forth between tabs, the functionality on some items is lost when I return to that tab. That led me to question whether or not I was structuring it all correctly. Google searches turned up nothing so I decided to...

Is there a way to use both relative and absolute year ranges on the jQuery Datepicker?

For the datepicker control in jQuery UI, is there a way to mix absolute ranges with a relative range? For example, how would you express, I want the year to only go back to 2005, but only show up to the current year? I've tried mixing the two, using something like '2005:+0', but this results in no years being available in the menu. Ye...

jQuery empty selector (null selector)

Sometimes it is useful to have an empty jQuery object, to be used either as a default value or as an initial value, when constructing a collection of items. For an example, see here. One way to do it would be to use a selector which is unlikely to match anything, like $('skdhjfksjdhfksjhdf'), but this is obviously inelegant. How can I...

Returning .net Hashtable from a JQuery ajax request

I have a webmethod that returns a Hashtable through a jQuery ajax call along the lines of: $.ajax({ type: "POST", url: webMethod, data: {} contentType: "application/json; charset=utf-8", dataType: "json", success: function(json){ **alert(json.d);** }, error: function(XMLHttpRequest, textStatus, errorThrown)...

What is jQuery's equivalent to Prototype's Ajax.Responders.register?

Is there a jQuery equivalent to this prototype code? Ajax.Responders.register({ onException: function(x,y) { if(y.message!="Syntax error") new Insertion.After("toperrorbox","<p style='color:red'>"+y.message+"</p>"); } }); ...

jQuery: select the first five rows of a table

How can I quickly get a jQuery selector for the textboxes in the the first 5 rows of a table? I have a table with many rows and many textboxes; I'm just trying to select the textboxes in the first 5 rows of the table. Is there an easy way to do this? ...

Jquery toggleClass issue

initially hovering works and the "over" class is added on mouseenter and removed on mouseout, but after doing some hovering over paragraphs with class="risk" the toggle class becomes stuck, and mouseover removes it instead of adding the class (opposite of expected functionality) //changes risk map point color when hovering over // r...

Overwrite .data() if a condition is met.

I am doing a image Tool tip (larger preview), it ads a .data() of the replaced source. but on .error i want the same data to have a different value. It seems like that doesn't overwrite the .data("lrgSrc") on .error $ImgTipCanid.each(function() { var t = $(this).attr("src"); var tt = t.replace(/medium/,"Large"); var ttt = t.re...

Simple jQuery show/hide table

I have this simple JQuery function to hide or show a table. the show/hide works but the image (plus/minus) is not changing. The table is like this: <span id="collapsible">These are some new titles. <table id="data"> <tr> <th colspan="3">2008</th> </tr> <tr> <td>As You Like It</td> <td>Comedy</td> ...

Very Simple jQuery click through gallery

I've been looking through all the galleries and most are too complicated for my use - I need a simple way to stack nine images in a div and onClick rotate through and then cycle back to the top. Are there any good tutorials or a simple jQuery script to use for this? ...

How can I check for exact length using jQuery Validation?

Using the jQuery Validation plugin to validate forms, how would you confirm that a string is exactly X characters long? ...

Why does JQuery not fade a flash object properly?

I am trying to fade out a Flash embed object and fade in regular Html. For some reason the callback of the fadeout method gets fired multiple times, before the fade out has finished. The result is that the Html gets appended multiple times in the callback function and it blinks an extra time. This doesn't happen when I try fading regu...

jQuery.ajax - submit all elements in form without manually entering them

Hi. I would like to use jQuery.ajax to submit a form using POST without having to specify everything manually in the "data: " part. This is what I don't want: data: "username=" + document.getElementById("username").value + "&email=" + document.getElementById("email").value, Is there a way to just have it include alla element...

jQuery pitfalls to avoid

I am starting a project with jQuery. What pitfalls/errors/misconceptions/abuses/misuses did you have in your jQuery project? ...