jquery

jQuery vs MicrosoftAjax in ASP.NET MVC

Under what circumstances would you use MicrosoftAjax over jQuery in an ASP.NET MVC application? According to Scott Cate in this podcast Object Oriented AJAX with Scott Cate MicrosoftAjax is good for sending and retrieving data to and from the server. And jQuery is good for manipulating your data via the DOM once it arrives at the client...

Getting correct index from input array in JQuery

How do you get the proper index of a selected input from a set of input elements with irregularly numbered indexes using JQuery? JQuery's "index" function always returns a value starting from 0 instead of the indexes I used. My code is below: JQuery: $("input[name^=myboxes]").click(function() { var element_id = $("input[name^=my...

jQuery keypress() event not firing?

I am trying to fire an event on the right and left arrow key presses with jQuery. Using the following code, I can fire events on any of the alphanumeric keys, but the cursor keys (up, down, left, right) fire nothing. I am developing the site primarily for IE users because it is a line of business app. Am I doing something wrong here? $(...

How can I create an empty HTML anchor so the page doesn't "jump up" when I click it?

I'm working on some JQuery to hide/show some content when I click a link. I can create something like: <a href="#" onclick="jquery_stuff" /> But if I click that link while I'm scrolled down on a page, it will jump back up to the top of the page. If I do something like: <a href="" onclick="jquery_stuff" /> The page will reload, whi...

Calling .Net webservice with Jquery is causing woe when trying to post data

The following code executes properly when the data key has no data to send, i.e. data: "{}" an empty JSON object and the webservice takes no parameters. I would like to post some data to the webservice but I am running into trouble. When I try to set this to data:"{'name':'Niall','surname':'Smith'}", I get an error {"Message":"Invalid...

jQuery not working on my host?

I am working on a site, and everything is working in my local environment as well as on a test server I have here and everything works fine. but when I upload it to my host, nothing seems to work!? The Asp.Net javascript validators fire, but any and all of the jquery is not working? I even put in a simple $("#test").html("working");...

jQuery and ASP.NET - forcing button click

I have a ASP.NET page which has a form on it. It also has a search form on it. The search is in the top-right of the page, so the button for the search is the first added to the control hierachy. When you're working on the other form and press enter it will click on the search button. I don't want this, I would prefer that when you pres...

jQuery: Set click from array loop.

Hi All, I have a series of divs in a pattern of header/body, where a click on the header will show the body in question. This all happens with .click initialized on page ready... Rather than doing this (which works fine, but is a pain): $('#show_fold_ping').click(function(){ ShowArea('#fold_ping') }); $('#show_fold_http').click(funct...

JQuery refresh database results on click

I have this code in JQuery: $().ready(function() { {exp:weblog:entries weblog="locations" show_expired="yes" show_future_entries="yes" orderby="date" sort="desc" limit="5" rdf="off" disable="member_data|trackbacks" status="open|featured|ongoing"} $('a.Favorites_Trigger_{entry_id}') .click (function() { $.get(this.href, function(data) { ...

Highlighting columns in a table with jQuery

I have a table and I am highlighting alternate columns in the table using jquery $("table.Table22 tr td:nth-child(even)").css("background","blue"); However I have another <table> inside a <tr> as the last row. How can I avoid highlighting columns of tables that are inside <tr> ? ...

The file size of jQuery

On jQuery's official website, they say the minified file size is 18k, but after downloading, I found that is 53.9K, do I have to do something to compress it after downloading? ...

The select element should return 2 values.

I have a select box with options in it. The value of the options gets the id of the item that is displayed in each option. I do have an other value that should be linked on this option. Is there an easy way to do this? <select id="category" name="data[cat]"> <option value="12" label="0">A</option> <option value="7" label="0">B</option...

Jquery confirmation box

I'm looking to create a generic confirmation box that can be used by multiple widgets easily, but I'm running into problems with scope and was hoping for a clearer way of doing what I'm trying to do. Currently I have the following - (function() { var global = this; global.confirmationBox = function() { config = { ...

jQuery Forms Authentication with ASP.NET MVC

Is it possible to use a jQuery ajax call to perform Forms Authentication with ASP.NET MVC? I've been unable to find any such examples. More specifically, how do I set the auth cookie on the page (without a redirect) so I can make successive authenticated ajax requests? ...

jquery - setting the selected value of a select control via its text description

I have a select control, and in a javascript variable I have a text string. Using jQuery I want to set the selected element of the select control to be the item with the text description I have (as opposed to the value, which I don't have). I know setting it by value is pretty trivial. e.g. $("#my-select").val(myVal); But I'm a bit ...

How to stop ASP.NET from changing IDs in order to use jQuery

I have this label control in my web page <asp:Label ID="Label1" runat="server" Text="test"></asp:Label> And when the page rendered the id of the control changes to something like this <span id="ctl00_ContentPlaceHolder1_Label3">test</span> How can I stop asp.net from changing IDs in order to perform a jQuery operation like this ...

Using jquery .ajax to retrieve records from mySQL DB

I am a mySQL noob, and have a slightly stupid question... I am using jquery to send form to a php script which then stores the data in a mySQL database. On another page in my app, I need to get all the values from one column of said mySQL DB, using jquery again (I assume I will also have to write another php script) so I can use the re...

jQuery assertion support / defensive programming ?

Is there any built in support in jQuery for basic assertion checking, primarily of things like 'expected number of returned elements'. For instance I may have a simple statement like this : $("#btnSignup").click(function() { return validateForm(); ); Now theres plenty of reasons why $("#btnSignup") may not return exactly 1 ite...

How to build a portal page with saveable state in jquery UI?

Hi, I know I should spend more time researching this and having a go before asking the question but I've got just 2 weeks to build a site with a portal style homepage (much like http://www.bbc.co.uk). I'm fairly good with jQuery and have played with jQuery UI draggables in the past but I was wondering if there were any tutorials or bes...

How do I keep events elements added through a ajax call in jQuery "active"

I'm placing content on my page through an ajax (post) request like so: $("input#ViewMore").click(function() { var data = { before: oldestDate, threadId: 1 }; $.post("/Message/More", data,function(html) { $('tbody#posts').prepend(html); return false; }, "html"); return false; }); with th...