jquery

Can't focus input field in DOM loaded with ajax call

I have gone insane trying to figure out how to make this work. Code looks roughly like: function onDropDownChanged() { $("#updatePanel").load( "myUrl", { id: $("#myDropDown option:selected").val() }, onPanelLoaded ); } function onPanelLoaded() { $("#theTextInput").focus(); } $(document).ready(function() { $("#myDropD...

Using an HTML snippet for a template in JavaScript (jQuery)

I currently am working on a little app that requests user info from my server and displays them using a special template. At first, I just hardcoded the little snippet in jQuery: $("<li><div class='outer'><table><tr><td rowspan=2 class='imgcontainer'><img class='thumb'/></td><td><span class='username'/></td></tr><tr><td><span class='n...

dojo, prototype and jquery

Hi, I've been programming in PHP for some time now, and id like to start learning how to create more dynamic websites using AJAX. The question is - where do I start? Heres' what I'm considering: prototype + script.aculo.us dojo (with/without Zend Framework) jquery What book should I buy? Are these different libraries, or the same?...

Is it possible to simulate intersecting 'droppables' in jQuery UI?

Say I have a draggable with width 2x that needs to be dropped on an area with width 3x, either at the leftmost or rightmost end (leaving a gap of x on the other side). So for instance I have a draggable div that is being dropped on a tr with three child tds, and can either be dropped simultaneously on the 1st and 2nd td, or 2nd and 3rd t...

Unify $ function of Prototype and JQuery

Is there any JavaScript function that can unify $ function from both Prototype and jQuery? Yes, this is the real use case I am facing now. I find $ function in Prototype and $ in jQuery is conflicting each other. I know that we could us jQuery.noConflict() to ressign $ back to Prototype, however by doing so, I will have to rewrite jqu...

It works. But is it best practice?

When I start to learn a new language, I always feel like I'm not doing it the practical, standard way. So here's a question regarding jQuery and if what I'm doing is acceptable. I have 3 images. <img src="del.png" class="delete user" /> <img src="del.png" class="delete event" /> <img src="del.png" class="delete recipe" /> Then I have...

Class variable in javascript class

The solution to this question suggested the use of John Resig's class implementation. This solution covers all my needs except: How to declare a public global variable inside this class that can be accessed from outside? I would like to establish something like the following: var MyClass = Class.extend({ EVENT_NAME : 'eve...

Viewing JQuery selections

Is it possible to see what items/elements I have selected in a particular jquery selection? I saw someone demoing jquery and they used some form of console that returned an array of items for every selection, they could then mouseover each item and it would highlight it in the browser. Im currently using alert($('div').length); to see...

Jquery Popup Problem in ajax

I am using jQuery and AJAX. When clicking the Hyperlink, the associated document to be loaded in Popup Menu works fine. The problem comes when I use AJAX. My Code: //index.html .... jQuery.ajax({ type:'POST', url:' my.php', data:'one='+one, success: function(data){ jQuery("#another").l...

jqGrid with custom cell colors

Is it possible in jqGrid(jquery grid http://www.trirand.com/blog/) to have custom cell text colors e.g. in price column i want red if price > 100$ and green if price < 50$ else grey? More generally do jqGrid provides hooks to change grid cellview, e.g. i can register a callback whenver cells of price column are created or modified. o...

Promote callback onSuccess return value to the Caller Function return value

I have a javascript function that calls a generic function to make an ajax call to the server. I need to retrieve a result (true/false) from the callback function of the ajax call, but the result I get is always 'undefined'. A super-simplified version of the generic function without all my logic would be: function CallServer(urlContro...

How do I send values between pages using javascript?

I am currently using a javascript code to make an entire row in my table clickable. Once the row is clicked a function is ran, I am wondering what I can use to redirect to a PHP page and preferably send a post variable along with it. My guess is AJAX but I am not sure how or if it would work. My Javascript Function: function DoNav(t...

How to dispose of DOM elements in JavaScript to avoid memory leaks

I have an application that allows a user to view details on a specific case w/out a postback. Each time a user requests data from the server I pull down the following markup. <form name="frmAJAX" method="post" action="Default.aspx?id=123456" id="frmAJAX"> <div> <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" /> </div> <div> <i...

neat way to implement a jquery custom filter (selecting based on parent's class)?

Hello, I want to select every textarea that does not have a DIV with class red among its parents, do something to each, and then do something else with the rest of textareas on the page. In other words, select a set of elements, work on only some of them, and then do something else with the rest. I know I can do something like below, b...

jQuery Image Swap for Hovering over Div's

$(document).ready(function(){ // Hide all large images except the first one $('#imageContainer img').hide().filter(':first').show(); // Select all thumb links $('#thumbContainer a').hover(function(event) { // Hide all large images except for the one with the same hash as our thumb link ...

jquery script executing but not setting css for .show

Hi, I have jquery code that is being reused by a repeatable partial view on an asp.net mvc page but the script is not executing as I expect it should. The scenario is not that complex, I have a page with multiple reviews for an item, and users who are logged in are allowed to 'vote up' or 'vote down' a review via a thumbs up/thumbs down...

Using an external element as handle on jQuery Sortable/Draggable

Hi, I need to show a div over the some items in a sortable list. This div shows information and needs to be use as handle for the sortable item. The problem is that this div is located outside the items (at the end of the body), and since sortable handle option only looks for child elements (because it uses a .find() to look for) it's ...

Using jquery tabs with my layout my tabs have a huge gap before they start

I currently have a 2 column site layout, with a footer/header, a fixed width left column which contains a menu, and a right hand column which takes the rest of the available space. My lefthand column contains a fold out menu, and it seems that when I have tabs in the right hand column, the text within the selected tab only begins after ...

JavaScript before jQuery

Duplicate: What are some of the pros and cons of using jQuery? Should I avoid using a JavaScript library while learning how to write AJAX client code? I've read it so many times... "I'd learn JavaScript before learning something like jQuery" - but is this really necessary for every situation? Sure, some people like to kno...

Best ways to display notifications with jQuery

I have a form which is a simple CRUD. I am trying to display a cool looking success message when user enters or deletes a record. I've seen this a lot around the web. I am very new to jquery. does anyone know any examples that would show how to do this? Basically a div that would slowly dim out. ...