jquery

Subscribe to $().ready function in jQuery

Hi, On each page I create my custom js object. I want to subscribe to the $().ready event so that when it fires, my objects init fucntion also fires. is this possible? Updated My object looks like: var blah = function() { var init = function() { //init function stuff }; return { InitPage: function() { init(); ...

jQueries equivalent to YAHOO.util.Event.addListener

Hi, Does jQuery have an equivalent method to YAHOO.util.Event.addListener ? ...

How do I secure my JsonResult GET calls?

I know how to use MVC's AntiForgeryToken attribute and it's associated HTML helper to help XSRF-secure my application's form POSTs. Can something similar can be done for JsonResults that implement GET? For instance, my View contains an onSubmit jQuery call like such: $.getJSON("/allowActivity/YesOrNo/" + someFormValue, "{}", function(...

Adding additional HTML rows: where to put the code?

I have the following situation: <table><tr><td width="50"> <select name="angle"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> </select> </td><td> <input type="text" name="what" value="" /> </td></tr></table> <...

Javascript Result to generate Jquery CRUD ajax operations

Latest Asp.Net MVC RC permits to return JavaScript ActionResult. I'd like to dynamically generate from the controller the Jquery script code associated to perform the classical $.ajax calls to the controller for Create Read Update Delete operations in ajax instead of classical get/post form actions. Should I generate the javascript code ...

Click on div, but want child elements to react to click

Hi, My dom looks like this: <div class="profile"> <a href="#"><img src="/img1.gif" /></a> <b>100</b> <a href="#"><img src="/img2.gif" /></a> </div> Ok so I have many of these elements on my page, so using jQuery I bind all the events like this: $(".profile").live('click', myCallback); var myCallback = function(event)...

Call JQuery function from code behind (aside) ASP.Net and C#

I need to disable JQuery tabs programmatically. The tabs are inside an update panel (Ajax) and the update panel is in an ASP.NET page. Code: <link type="text/css" rel="stylesheet" href="http://ui.jquery.com/testing/themes/base/ui.all.css" /> <script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"&gt;&lt;/script&gt...

JavaScript Library Performance Comparisons - any resources out there?

I'm putting together a presentation to my company on the reasons I'm adopting jQuery as the preferred JavaScript / AJAX library. While most of the work is done, a comparison between different libraries would be of great use - especially against the Microsoft ASP.Net Ajax framework. Now please note I'm not after a theological debate on ...

Adding additional js files breaks jQuery IntelliSense

I have been using jQuery IntelliSense in VS2008 and it has been great. Recently I added a reference to jQuery UI and since then, the jQuery IntelliSense has went away. I found that once you reference another .js file in your document, the IntelliSense goes away. Any way to avoid this? ...

Jquery checking success of ajax post

how do i define the success and failure function of an ajax $.post? ...

Javascript Date Localization

I'm working with an ASP.NET app with localization and globalization. I'm having some difficulty understanding how to get the Date() function in javascript to work properly given the user's environment. My user base is split between Mexico (spanish) and the US (english). Since the Mexico date format is dd/mm/yyyy and the english format...

IE focus on form element in ajax response

i have tried setTimeout, eval, try/catch, callback functions etc and nothing works reliably. this has been driving me nuts for ages! here is a test case ...

Submitting a Javascript object to PHP

Dear fellow developers, A newbie question from me, please. I have a large data set that I prefer to be submitted as an object instead of an array; e.g. foo = bar = baz = {}; $.ajax({ url: "index", type: "post", data: { foo: foo, bar: bar, baz: baz }, dataType: "json" }); Upon submit, Firebug tells me that I have submi...

jquery session - dynamic variable naming

hi. just having a problem here. i'm doing the UI of a web-based app using jquery, css. there's a shopping a cart, and i want to store the selected items in the session, i used jquery.session plugin. e.g. var $.session("var1","item1"); What i want is to dynamically store items into dynamically named variables. how could i do that? thank...

google.setOnLoadCallback with jQuery $(document).ready(), is it OK to mix?

I'm using Google Ajax API and they suggest I use google.setOnLoadCallback() to do various things related to their API but I'm using also jQuery's $(document).ready() to do other JS things, not related to Google API. Is it safe to mix these two approaches in one document? I did not notice any problems yet but I suppose it's a matter of s...

YUI 3 Chaining

YUI 3 allows you to write Y.all(".foo").removeClass("bar"); However it does not allow writing Y.all(".foo").removeClass("bar").set("innerHTML", "baz"); It seems all the "operational" methods always terminate the call chain. This means YUI 3 only provides half the power of chaining that jQuery provides. Does anyone know why this is, an...

Limiting number of lines in textarea

Hi, I'm looking for a javascript that can limit the number of lines (by line I mean some text ended by user pressing enter on the keyboard) the user is able to enter in textarea. I've found some solutions but they simply don't work or behave really weird. The best solution would be a jquery plugin that can do the work - something like C...

Javascript Not Firing after Dir Reorganization

Ok, so here's the situation. I'm working on a site that allows people to upload things to a database that are then pulled to the frontpage so people can see them. It is a pretty straightforward site and I had it working real well but i was developing everything at ../html/backend for the sake of simplicity and to make sure nothing was s...

Nested jQuery Cycle ?

Hi, I am trying to build a slide show with jQuery cycle plug in. In the slide show there are contents and inside the contents there is basic image gallery. Timeout of cycle which image gallery uses is fewer than the contents timeout. So content waits for 15 second and the image gallery will have 5 pics with 3 seconds timeout which make...

Change height in jquery only working once

I've got a set of product listings that each have a link below them with a click event on it, when this is clicked it goes to the parent class, finds the class "surf_prod1" below and slideToggles it. Where a function that checks through all divs with a class of "surf_prod" and gets the biggest innerHeight which is passed back and used a...