jquery

jQuery UI Autocomplete Validation

Hi, I am trying to perform some sort of text field validation before the Autocomplete request results for the inputted text. My code: <script type="text/javascript" src="/scripts/jquery-1.4.2.min.js"></script> <script type="text/javascript" src="/scripts/jquery-ui-1.8.2.min.js"></script> <script type="text/javascript"> $(function() {...

animate in jquery

i dont know why the element is not animating.. im just following what is the code from jquery.com $(document).ready(function() { var theW = 249 * slideThumbCount; $("div.bCont").css("width",theW).css("left","0px"); for(i = 0;i<slideThumbCount;i++) { $("<div>").attr("class","bsThumb bs_" + i).appendTo("div.bCont"); $("<img />")...

Standardizing attr('href') returns in jQuery

Suppose I have a link <a href='?action=run'>, on a webpage wwww.example.com/foo.html In Firefox, attr('href') returns '?action=run' In IE, it returns 'http://www.example.com/foo.html?action=run' When using attr('href'), usually which behaviour is expected (are there any standards?) Is it possible to make IE returns just '?action=run'...

Is it possible to encapsulate event logic to avoid duplicate code?

Say when a checkbox is checked/unchecked, I want specific behavior to occur. Now if there are multiple points in my code where I set a checkbox as checked/unchecked, I have to run through the same logic ever time. What is a way I can encapsulate the logic that occurs when a checkbox is checked, and just re-use that logic? ...

jQuery regex, remote with validation

I have this: <script type="text/javascript"> jQuery().ready(function() { // validate signup form on keyup and submit jQuery("#regform").validate({ rules: { NickName: { required: true, minlength: 2, remote : "user_availability.php", }, }...

Horizontal Accordion - jQuery plugin - scrolling animation bug on Firefox - how to debug

There is a plug-in for jQuery that allows you to build horizontal accordions, it works great in all browsers except firefox. My main problem is that I'm somewhat unfamiliar with debugging client side code, I'm a Java programmer mostly, although I do have a good understanding of client technologies, actually trying to debug this issue le...

jquery optimising hover event with div and an image

code: $('.featured').hover( function() { $(this).addClass('active'); $('img',this).fadeTo('slow', 0.5, function() {}) }, function() { $(this).removeClass('active'); $('img',this).fadeTo('slow', 1, function() {}) }); how can I improve this? I recall someone telling me once not to us...

Need help with logic on how to assign the correct value to a textbox

I am passing in a value to the form that I ultimately assign to a textbox using javascript. The value is a calculation based on values from another page/form. However, the textbox is editable. When reloading the form with the previously saved data, I don't want the value of the textbox to be overwritten with the pre-calculated value ...

Use jQuery to override the default action of the TAB key inside an element?

Hi, I have two text field boxes; username and password. There is also a checkbox below the username field. Currently pressing the tab button on they keyboard results in the checkbox gaining focus, I would like to override this so that tab key would bring the password field into focus. Does anyone know how to do this using jQuery or ho...

Validating a radio button is checked with jQuery

On my form I havea set of radio buttons. Here's the mark up: <div class="optionHolder"> <p class="optionName">Format</p> <div class="option checked"> <input type="radio" name="fileType" value="avi" /> <img src="images/avi.png" alt="" /> <label>AVI</label> </div> <div class="option"> <input...

Cufon text overlays Fancybox

Hi. I'm using the Cufon library to display some text on this page. If you look (via Firefox 3.6.x) at the section called "Thank You Gifts" and click the text in that area, you'll see a Fancybox (ver. 1.3.1) pop up. When it pops up, I have to hide the Cufon text title of the section or it will overlay the Fancybox. How do I fix this so ...

Issue with jScrollPane, updating from v1 to v2?

Hello there, I have recently bugged Kelvin Luck about an issue I was having with v1 and the scoller not loading due to images appearing after the scroller had initialised: 'scrollpane contains images and needs to reinitialise after the images have loaded'. After upgrading to v2 the scroller disappeared: http://sugarhut.janddmedia.com/t...

Gracefully handling HTML tags on form submission in asp.net MVC 2

Hi I have a MVC site and will have users inputting text to be displayed on a web page. I am trying to come up with a graceful way of handling any HTML that the user try's to input - as you will probably be aware MVC 2 throws an error for any HTML in the text. I use ViewModels and decorate my properties with filters from the DataAnotatio...

Why is this jquery code snippet failing

$(if($('#errorExplanation').length > 0)){ $('#venue_details').toggle($('#errorExplanation').length > 0); //if there is at least one errorExplanation element on the page, $("#venue_details").load("/load_events/"+ escape($('#request_artist').val()), successCallback ); } It seems like i am repeating myself with this code. I basic...

How do I use jQuery selectors with an object?

I have an unordered list in an object: var myUL = $('ul#theID'); //I send this var to another function in the code I want the direct children only of this object (I have another 'ul' within each 'li' that also has 'li's in it), but this selector does not work: $(myUL + '>li').each( etc, etc... It gives me the error "uncaught except...

How to tell if an image has loaded correctly

Is there a way to tell, after the fact, whether an image (placed with the <img> tag, not via JS) has loaded correctly into a page? I have a gallery of head shots, and occasionally the third-party image server ends up serving up a 404. I can change the server-side code to use an onerror="showGenericHeadshot()", but I really want to avoid ...

Jquery - operators in if statement

Hi All, I'm trying to submit a form to a different location depending on which (of two) form fields have been filed in. It work when both fields have a value but when only one if field has a value it always submits to the suppliers/category/ URL. Here is my code. $('#suppliersForm').submit(function() { catVal = $('#category').val() k...

Cannot render events on FullCalendar from JSON feed

Hi, I got a page that returns json info from a cfc. the json looks like this: [{"allday":true,"title":"event1","userid":1,"end":"","classname":"","editable":true,"start":"2010-09-01","id":1,"url":""},{"allday":true,"title":"event2","userid":1,"end":"","classname":"","editable":true,"start":"2010-09-10","id":2,"url":""},{"allday":true,"t...

Jquery - Load text with fadeIn, change text after 5000 and stand still. Random selection of text.

Hi, I have big problem for my little jQuery abilities! I would like to load a textString from a text file (randomly) via jQuery. At first the text should fadeIn, then stand for 3 sec., then fadeOut again, then a the textLink should fadeIn for 3 sec. and stand and stop (no more changing). Both text should appear in the same <div>. TextF...

IDE Like interface with jQuery (Resizing divs)

Hello, I am planning to develop a site which will have interface very similar to IDE I was wondering if there is a jQuery plugin which allows the resizing of divs (horizontal / vertical based on settings) or any ideas on what would be the best approach. ...