jquery

jQuery Safari/Chrome incompatibility with draggable containment property

This code works in Firefox, Internet Explorer, not in Safari/Chrome: <head> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="jquery-ui.js"></script> <script> function newDiv() { var div = $('<div id="divNew" style="width: 50px; height: 50px; border: solid 1px; b...

Is there any way to 'hide' a JavaScript file from IntelliSense in Visual Studio 2008?

I have a third party JavaScript plug-in but including the file breaks IntelliSense for jQuery amongst other things. The only way I can get IntelliSense back working with jQuery is by commenting out the plug-in. Is there a way I can hide the plug-in file from the IntelliSense parser? ...

jQuery validation formatting Issue in IE

In firefox, the error messages display as should. Just to the right of the element being validated. In IE. No matter what I do with the sizing of the labels/elements/errors, the error is always posted below the element, causing every other element to be pushed down. <p> <label for="handle"><strong>User Name</strong></label> <IN...

Paged table with ASP.NET MVC and AJAX

I'm looking for good patterns for implementing a paged table of results in ASP.NET MVC with sorting, filtering, and paging provided via AJAX. It seems to me that I should have my controller actions provide only the data and not mark up to maintain the separation of concerns -- so the Ajax callback would provide new table data and pager ...

Get value from dropdownlist en use value in UrlHelper

I would try something like this but it isn't allowed. function GetDynamicModulesProperties() { var selectedValue = $("#moduletype option:selected").val(); if (selectedValue.lenght() > 0) { var url = '<%= Url.Action("GetModuleProperties", new { sectionid = ViewData.Model.Id, moduleTypeId = selectedValue } ) %>'; ...

How to know when all ajax calls are complete

I have a table style page with rows. Each row has a checkbox. I can select all/mamy checkboxes and click "submit" and what is does is a Jquery ajax call for each row. Basically I have a form for each row and I iterate over all the checked rows and submit that form which does the jquery ajax call. So I have a button that does: $("...

jQuery: Is req.readyState == 3 possible?

I am a big fan of jQuery and I use it for 95% of all my Javascript needs. However, I am a loading a live page using a COMET method; where in Javascript I retreive the data using AJAX at the point where req.readyState == 3. I was curious if it's possible to do this with jQuery $.ajax too (I couldn't find anything in the documentation). ...

How to stop title attribute from displaying tooltip temporarily?

I've got a popup div showing on rightclick (I know this breaks expected functionality but Google Docs does it so why not?) However the element I'm showing my popup on has a "title" attribute set which appears over the top of my div. I still want the tooltip to work but not when the popup is there. What's the best way to stop the tooltip...

jQuery Zebra selector

I have a CSS class called grid which I place on my tables. I want to Zebra strip my even rows so I use the following jQuery code $(".grid tr:nth-child(even)").addClass("even"); This basically says "Apply the css class even to any tr tag which has a parent (at any level) with a class of grid." The problem with this is when I have neste...

Testing objects for ancestor/descendent relationship in JavaScript or Jquery

I'm trying to come up with a reusable JS or jQuery function that would allow me to test if one object is a DOM descendant of another. I've seen a model of testing for $b.parents('nodename').length>0 Which is fantastic when you only need to check if an element is a child of any node by that name. But what about a specific node? You...

jQuery Toggle function doesn't work on 1st click

I realized the solution to this problem while I was creating the documentation to ASK this question...so I am posting the answer if for no other reason than to keep me from wasting time on this in the future ...

Strange jQuery AJAX Firefox Issue -- Page Randomly Won't Finish Downloading

I have this strange issue with my web app. You see, I'm using jQuery with the Forms API and doing $('#MyForm').ajaxSubmit(api parms and callback function goes here). Randomly when I do this, however, and only on Firefox, the page load icon starts spinning, the page load progress bar runs in the status bar, and the stop button goes red -...

How to return JSON from a 2.0 asmx web service

I saw another question like this but it did not answer my question. I am using .Net framework 2.0 / jQuery to make an Ajax call to a 2.0 web service. No matter what I set the contentType to in the ajax call, the service always returns XML. I want it to return Json! Here is the call: $(document).ready(function() { $.ajax(...

Is there a Request.IsMvcAjaxRequest() equivalent for jQuery?

I prefer to use jQuery with my ASP.NET MVC apps than the Microsoft Ajax library. I have been adding a parameter called "mode" to my actions, which I set in my ajax calls. If it is provided, I return a JsonViewResult. If it isn't supplied, I assume it was a standard Http post and I return a ViewResult. I'd like to be able to use somethin...

jQuery droppables - Change element on drop

Hi all, I'm a bit new to jQuery and hope somebody can help me out. I'm trying to change an element (li) to another element (div) after the (li) has been dropped. Sample code: $("#inputEl>li").draggable({ revert: true, opacity: 0.4, helper: "clone" }); $("#dropEl") .droppable({ accept: ".drag", hoverClass: "dropElhover", d...

How to order events bound with jquery

Lets say I have a web app which has a page that may contain 4 script blocks - the script I write may be found in one of those blocks, but I do not know which one, that is handled by the controller. I bind some onclick events to a button, but I find that they sometimes execute in an order I did not expect. Is there a way to ensure ord...

jQuery UI - when to use destroy

When I attach functionality to an element do I need to call .widgetName('destroy') before removing it from the DOM or does jQuery handle this? ...

Image Dropdownlist

I am looking for a drop down list which can present the user with a series of images to choose from. Each image will be about 50x50 pixels and a small text description will be under the image. A jQuery and compatable ASP.NET solution would be preferred. ...

Best way to find "next" form input element in jQuery?

Using jQuery, what's the best way to find the next form element on the page, starting from an arbitrary element? When I say form element I mean <input>, <select>, <button> or <textarea>. In the following examples, the element with the id "this" is the arbitrary starting point, and the element with the id "next" is the one I want to fin...

How to use jQuery to grab the values of checkboxes and spit them into a different form field

I have a form that contains a bunch of checkboxes. Before submitting the form, I'd like to grab the values of the checkboxes and stick them into a text field, then submit that. So I might have: Red Orange X Yellow Blue X Green And I'd like my textfield to end up with the content "Yellow, Green" . This doesn't seem too co...