jquery

Faster Javascript text replace

Given the following javascript (jquery) $("#username").keyup(function () { selected.username = $("#username").val(); var url = selected.protocol + (selected.prepend == true ? selected.username : selected.url) + "/" + (selected.prepend == true ? selected.url : selected.user...

Can you display a jQuery UI modal dialog when user attempts to close the browser?

I know how to show an alert when the user exits the browser and I know how to implement a neat modal dialog using the jQuery UI library. My problem is, I'd like to implement that dialog when the user attempts to close the browser rather than display the ugly little popup box. Is this do-able? ...

JSON / JSONP in JQuery

Hello. I am trying to figure out why my $.getJSON method does not seem to be working but the $.ajax works just fine. First, here is my getJSON call: $.getJSON("http://localhost:1505/getServiceImageList?callback=loadImagesInSelect", loadImagesInSelect); You can see I have tried added the callback parameter directly to the query strin...

jQuery: looking for a lightweight suckerfish menu plugin

hi, i'm looking for a good suckerfish-like-menu which supports both vertical and horizontal layout, multi levels and delayed collapsing on mouseout. any recommendations? thx ...

How to use the jquery .load() function to return the innerHTML of an element

JQuery Assume this works: $('table td').load('/my/url/ div p'); I would end up with <td><p>Some Text</p></td> I want to end up with <td>Some Text</td> How would I do that? ...

Hiding elements based on last closed element jquery script

Hi my question is, how can I make this jquery script close all previously opened children when entering a new parent? At the moment it traverses thru all the tree structure fine, but switching from one parent to another does not close the previous children, but rather only the each individual parents elements as a user browses. Here is ...

Javascript html grab from external iframe + calling a controller action with data

Preface: I consider myself "slightly effective" in ruby on rails, and a complete novice in javascript. Also, yes, I have installed jQuery and associated plugins instead of the default Prototype library. I am in a situation where I am pulling in a table from off-site in an iframe (which is taking care of all internal JS for me) such that...

how to use trigger in Jquery to pass parameter data as well as control (this)

I am trying to use same validation funtion for all my controls. But I dont know much in jquery and not been able to pass event handler to the trigger. I want to pass textbox id to my custom function. How can i do this <script src="http://code.jquery.com/jquery-latest.js"&gt;&lt;/script&gt; <script type="text/javascript"> $(document...

Jquery - removing an image before the client browser attempts to download it

Hi there, I wonder if anyone could help me with a problem I've been having. I have a number of large images available, but due to space limitations, I can't create multiple copies of these at various sizes. I have used PHP GD functions to resize the images to the sizes I need and output them to the browser. This works, but obviously tak...

Submit event from few forms

I have a two or more forms on my page in a row. I'm trying to hook submit event like: $('form',someObj).submit(function(e){ /* Do some stuff with ajax */ return false; }); But always receive events only from a first (by code) form. Also used each() function to bind event for each object, same thing.. What's wrong? Thanks! ...

External event to Fullcalendar

I need to create a dinamic page with a Fullcalendar plugin. I want to drag event (div) to calendar from a sidebar. Any idea to do this with Fullcalendar or with other plugin ? Any example ? I found this link http://github.com/arshaw/fullcalendar/tree/fcdraggable, but don't work fine and it has some bug. ...

How do I keep child elements together with parent jQuery sortable.

I have a list of items like this... <ol> <li> <span></span> <img src="image.png" /> <p>Image Caption</p> </li> </ol> And I want to be able to sort the LI's but not the sub elements, they should just move with their parent. I am using the jQuery to do that... $('ol li').sortable({ 'cursor': 'move' }); ...

Why isn't there a $('.someSelector').id() method in jQuery?

I was wondering if anyone knew why jQuery doesn't have a simple $().id() method. It seems silly to have to pull the id using $().attr('id'). I would think that the id attribute was common and useful enough to have its own call. ...

Jquery set attribute for a label

Is it possible to set "for"(AssociatedControlID) attribute using jQuery? I am trying something like this to set it to the very next control that appears after label: $('label.asssociateClass').each(function() { var toAssociate = $(this).next(':input'); $(this).attr("for", toAssociate.attr("id")); }); The problem is that...

jquery $(window).width() and $(window).height() return different values when viewport has not been resized...

I am writing a site using jquery that repeatedly repeatedly calls $(window).width() and $(window).height() to position and size elements based on the viewport size... In troubleshooting I discovered that I am getting slightly different viewport size reports in repeated calls to the above jquery functions when the viewport is not resized...

jQuery regex over multiple lines

I have the following string: <img alt="over 40 world famous brandedWATCHES BRANDs to choose from " src="http://www.fastblings.com/images/logo.jpg"&gt;&lt;/strong&gt;&lt;/a&gt;&lt;br&gt; I want to define a regex pattern like <img alt="(.+?)" src="http://(.+?).(jpg|gif)"&gt;, but as you can see the target string has a linebreak in the a...

Create Slideshow with Fade Transition and Navigation

Hello! I am trying to create a slideshow like the one on this site: http://www.marthastewart.com/ However, I would like to use JavaScript and CSS instead of Flash. I would be super grateful for any suggestions on how to do this. I am currently using the InnerFade plugin, which works great for the slideshow part, but I can't figure out...

How to move child element from one parent to another using jQuery

I am using the jQuery DataTables plugin. I would like to move the search box (.dataTables_filter) and number of records to display dropdown (.dataTables_length) from their parent element (.dataTables_wrapper) to another div on my page without losing any registered javascript behavior. For instance the search box has a function attached t...

What's the best practice to add default function to jQuery Dialog open/close events?

Hi All, I'm trying to define some default behaviours for my jQuery Dialogs like the following: (function($) { /** * Overriding default options **/ $.ui.dialog.defaults.bgiframe = true; $.ui.dialog.defaults.open = function() { if ($('.ui-widget-overlay').length == 0) return; ...

jquery xml exists

I just want to use javescript /jquery to determine if and xml file exsists I don't need to process it I just need to know that its available or not. can seem to find simple check. thanks Edit trying load here is my code jQuery.noConflict(); jQuery(document).ready(function(){ var photo = '223'; var exists = false; jQuery.load('/...