jquery

Retrieve the last class in an element that has mutiple classes

How can I retrieve the last class in an element that has multiple classes assigned to it using Jquery ie. <div class="class1 class2 class3"></div> ...

Referencing and calling a method in JavaScript

I have some JavaScript/jQuery code that watches for the "changed" event on a checkbox: $(control).change(function() { alert("changed to: " + $(this).is(":checked")); }); This works fine. I'd like to create a reference to the change() function on the particular object, and call it indirectly, like so: var onSomeChange = $(control...

Can someone explain what the syntax means when defining a jQuery plugin?

Hi There, I am reading up on creating custom jQuery plugins and am a little confused as to the meaning of the following syntax: (function($){ $.fn.truncate = function() { return this.each(function() { }); }; })(jQuery); I understand that function($) is an anonymous function that accepts the $. I just don'...

Symfony: question about jq_link_to_remote()

Hi, i have a template with this below to show a dialog when the link is clicked: <div id="myDialog"> </div> echo jq_link_to_remote('Enviar mensaje 2', array( 'url' => 'mensaje/new?receptor='.$miembro->getId().'&tipo=0&estado=0', 'update' => "$('#myDialog'...

Scrollable table

In 2005, Stu Nichols posted this entry about have a fixed header with scrolling rows in a table. Is there a more updated solution to this task, or is what Stu wrote in 2005 still considered the latest? ...

jQuery checkboxes for multiple e-Mails

I'm working on a form for new students planning to attend a university and have checkboxes beneath fields such as Father Personal E-Mail, Father Business, Mother Personal, Mother Business, etc. I've been using code that can send to one address at a time, if ($('#sendFatherPersonalEMail:checked').val() !== null) { //Father Personal ...

jquery javascript content filtering

I'm looking for a pre-made content/text filter plugin that checks (as the user types in a textbox) the typed words against a list of inappropriate words. I then want to provide some sort of alert box or flag notifying the user that this language is unacceptable... Again, I'm looking for the easy-way-out, an existing content filter pl...

How do you remove the script tag added by cross-domain ajax?

I am using the JSONP/dynamic-script-tag technique to perform cross-domain AJAX (There's no XML, but you know what I mean). Initially, I wrote my own solution, but I could not come up with an elegant way to remove the script after it executed. My strategy was just to pass an ID and on the callback remove the associated script, but I real...

Html.RenderPartial user control retaining input focus in FireFox 3.6

Using jQuery Lightweight RichTextEditor plugin. When I use a partial view (user control) on my page the textarea rendered retains input focus even though I'm explicitly setting focus on the page load (setting z-index doesn't work either): $(document).ready(function () { $("input:text:visible:first").focus(); }); In Vi...

jquery ajax call fails in IE only

This ajax request checks if a TIF file exists in a certain directory and either sets a button to open the file or to display an error message if it isn't there. $.ajax( { cache: false, url: directory, success: function() { $("#img" + row).click(function() { window.location.href = direc...

jquery fade problem

This script sets a random color to the body and a div and should just fade between them: function randcolor(){ return ('#' + (~~(Math.random() * 16777215)).toString(16)) } var $body = $("body"), $div = $("<div style='display:none; position: absolute; top:0; right:0; bottom:0; right:0;'></div>") function havefun(){ $body.css("...

How does StreamHub do AJAX push through an iFrame?

Basically, how does this work: http://www.stream-hub.com/demo/RealTimeChart/index.html They are streaming JS through an iframe continuously and the browser window does NOT show the page as "loading". How did they do that? The streaming part is easy, but how do they prevent the browser window from being in a continuous "loading" state? ...

How do you detect the clearing of a "search" HTML5 input?

In HTML5, the search input type appears with a little X on the right that will clear the textbox (at least in Chrome, maybe others). Is there a way to detect when this X is clicked in javascript or jQuery other than, say, detecting when the box is clicked at all or doing some sort of location click-detecting (x-position/y-position)? Tha...

Changing various id's after cloning in jquery

I'm trying to clone a table row and update the multiple id's to reflect the input fields. I start by doing this and it works: $(id).clone().attr("id", "newId"); That changes the id of my main table row to the new id. In the table row I have other id's that need to be changed. For example: <input type="text" id="input_1"> Will be ch...

JQuery Multiple selector problem

<script> $(function(){ $("a.a, a.b, a.c, a.d").click(function () { alert('Hi'); }); }); </script> <a href="#" class="a button">Hi</a> The above JQuery unfortunately doesn't work. Probably an easy fix, any ideas? I need it to be a multi-selector, but with a's that have multiple classes unfor...

Live connection between server and client in a web page

How do I implement a real time updating /live html streaming method in applications like FriendFeed, Stackoverflow, Blip.fm ? Is it done using a jQuery/Ajax request from client to server every X seconds? (FriendFeed is like every 1 second) or there is another technique? ...

Fuel Gauge in JavaScript?

Looking for a fuel gauge in JavaScript (no flash please). I founf this site, anyone try it? FREE - Bindows™ Ajax Gauges Library Any other recommendations? Thank You, Greg ...

DataAnnotations jQuery validation in asp.net mvc 2

Hi, I trying to use jQuery validation plugin with DataAnnotations in asp.net mvc 2 final. Now I'm using MicrosoftMvcValidation.js and it works. But I can't find way to work with jQuery validation. I read about MicrosoftMvcJQueryValidation.js. But I think that it is obsolete. How can I use DataAnnotations with jQuery validation plugin? ...

JqueryUI serialize data not working on first record

I am using jqueryUI v1.8. I have created a modal dialog form to edit records of a table. When the edit link on the record is clicked the record data is displayed on the form and the user edits the record. When the user submits this form the data is serialized and posted via ajax to update the database. This works well with all records e...

Jquery: Mirror one text input to another

Hey Guys, I'm wanting to have one text field autopopulate with whatever the other text field has being typed into it. How do I go about this? Thank you! Hudson ...