jquery

Using "this" with jQuery Selectors.

I have some HTML that looks like this: <ul class="faq"> <li class="open"> <a class="question" href="">This is my question?</a> <p>Of course you can, it will be awesome. </p> </li> </ul> Using CSS I'm setting the 'p' tag to display:none;. I want to use jQuery to display or hide the 'p' tag when the anchor is cli...

Find all radio groups which haven't been selected

I have a basic quiz/survey type application I'm working on, and I'd like to give the user a prompt before they submit if they haven't answered all the questions. All the questions are multiple choice using radio buttons: <div class="question"> Q1: What is the second letter of the alphabet? <div class="choices"> <input ty...

jQuery won't parse my JSON from AJAX query

Hi, I'm having difficulty parsing some JSON data returned from my server using jQuery.ajax() To perform the AJAX I'm using: $.ajax({ url: myUrl, cache: false, dataType: "json", success: function(data){ ... }, error: function(e, xhr){ ... } }); And if I return an array of items then it works fine: [ { title: "O...

How to use variables in a JQuery call

I am trying to function doRow(rowNum) { $.ajax({ url: "z.html", cache: false, success: function(html){ $('#result + rowNum + "'").append(html); } }); This does not seem to work. I also want to pass variables to data attribute when I get that far. ...

JQuery-bound event handlers

Hi, I want to attach a 'click' event handler to the first child of an element with ID 'foo' using JQuery. I understand that the syntax for doing this is: $('#foo:first-child').bind('click', function(event) { // I want to access the first child here }) Within the handler body I want to access the element which caused the event to b...

count immediate child div elements using jQuery

Hi, I have the following HTML node structure: <div id="foo"> <div id="bar"></div> <div id="baz"> <div id="biz"> </div> <span><span> </div> How do I count the number of immediate children of "foo", that are of type "div". In the example above, the result should be two ("bar" and "baz"). Cheers, Don ...

delay JQuery effects

I want to fade out an element and all its child elements after a delay of a few seconds. but I haven't found a way to specify that an effect should start after a specified time delay. ...

How to reference an input within a form in jQuery

An easy jQuery question. I have several identical forms ( except their name ) on one page with a few hidden inputs in each. I want to refer to them by using the form name and then the input name. ( the input names are not unique in my page ) So for instance: var xAmt = $('#xForm'+num).('#xAmt'); I really want to supply these value...

jQuery and "Organized Code"

I've been struggling lately with understanding the best way to organize jQuery code. I asked another question earlier and I don't think I was specific enough (found in this question here). My problem is that the richer you make an application, the quicker your client side gets out of control. Consider this situation... //Let's start so...

How do you use the jQuery blockui add-in with MVC Ajax?

I have been reading the post here: http://encosia.com/2008/10/04/using-jquery-to-enhance-aspnet-ajax-progress-indication/ But it wants to use the following object: Sys.WebForms.PageRequestManager.getInstance() Which doesn't exist when using the MVC AJAX code. Has anyone tried to hook when the postback ends from MVC AJAX to know whe...

Switching DIV Background Image With jQuery

I am making an expand/collapse call rates table for the company I work for. I currently have a table with a button under it to expand it, the button says "Expand". It is functional except I need to button to change to "Collapse" when it is clicked and then ofcourse back to "Expand" when it is clicked again. The writing on the button is a...

Access parent property in jQuery callback

Unsure if I've phrased this correctly, but in the callback how do I reference the controls property of the base class? This has been bugging me for some time and I usually work around it, but I'd be grateful if anybody can enlighten me on how I should do this properly. var base = function() { var controls = {}; return { i...

Add another CSS Style to Child Elements which are also Parents

So my list looks something like this: <div="list"> <ul> <li class="page item">Parent 1 <ul> <li class="page item">Child of Parent 1 and Parent of Grandchild <ul> <li class="page item">Grandchild</li> </ul> </li> </ul> </li> </ul> </div> This is through Wordpress...

Improving a tooltip code

Hi everyone, I'm trying to build a hoverable Jquery tooltip. This tooltip should appear when I hover over some element, and stay put if I choose to hover over the tooltip itself too. The tooltip should disappear only if I hover away from the original element or from the tooltip body. Based on an example I found, I managed to create thi...

Detecting jQuery UI autocomplete

How can I detect whether or not an input box is currently a jQuery UI autocomplete? There doesn't seem to be a native method for this, but I'm hoping there is something simple like this: if ($("#q").autocomplete) { //Do something } That conditional, however, seems to always return true. ...

I'm a JS newb. How can I scale this?

Let me preface this by saying I'm a complete newb when it comes to front-end (and back-end, for that matter) development. Please keep that in mind. There. So I've got a form that's a few pages long. To traverse the form all I'm doing is showing and hiding container divs. The last page is a confirmation page before submitting. It takes t...

JQuery DatePicker bundled control can't be included in other controls

I've been tasked with implementing a Date/Time selector for several areas of our web project, and instructed to use a control that another developer created as part of it. The control I'm working on is supposed to allow the user to choose a date from a calendar, choose a format for the display of that date (from several pre-defined form...

Why doesn't jquery turn my array into a json string before sending to asp.net web method?

So far, I've only been passing javascript strings to my web methods, which get parsed, usually as Guids. but now i have a method that accepts an IList... on the client, i build this array of objects and then attempt to pass it like: $.ajax({ type: 'POST', url: 'personalization.aspx/SetPersonalization', data: "{'backerEntries':" +...

Underline a Hyperlink On Hover using jQuery

I used the method $("#dvTheatres a").hover(function (){ $(this).css("text-decoration", "underline"); },function(){ $(this).css("text-decoration", "none"); } ); Is there a more elegant method?(single line) ...

How can I set up a timed interval in javascript?

The following javascript should setup an interval so a new item from the list of json objects will be added to the top of the list slowly, but instead they are all added at the same time. <script type="text/javascript"> var json; var count = 0; $(document).ready(function() { $.ajax({ type: "POST", url: "/Home/PublicTimeLine",...