jquery

JavaScript DOM: transfer element between frames

I'm using the following jQuery code within an iframe (same origin) to try to move a node from the iframe to the main (top) document. var dest = $(window.top.document).find('#dest_id'); dest.append($('#source_id')); The following works ok: window.top.document.getElementById('dest_id').innerHTML = document.getElementById('source_id').i...

How good Adobe Spry comparing to JQuery and what are perspectives

It seems JQuery, its plugins and UI has largest popularity among JS platforms. I love and use Adobe technology stack every day, I wonder if Adobe Spry will be good addition to skill set. Is it good enough comparing to JQuery ? Spry development is not moving forward fast and there's not much information about it, does it have future ? ...

JQuery UI - Using Widgets Polymorphically

I was planning on creating several widgets using JQuery UI, and use them polymorphically. So, say I have two widgets called widget_1 and widget_2, both of which define a "public" method called testMethod(). I would like to blindly take either object and call the testMethod. Something like: widget.testMethod() However, JQuery seem...

Handling "other" option in dropdown select with free text input field

Hi, I'm trying to figure out the best way to handle a dropdown list where one of the options "other" shows a hidden text field (via jQuery), where the user can then enter text. Should both the dropdown and the input field be given the same "name" attribute, then server side code runs a check on the values of each in order to know what on...

JQuery - Extend and Access Superclass

Is there a way to access the super object when extending objects using $.extend? I would like to extend an object, override a method, but call the overridden superclass method in the subclass method. ...

How to update strongly typed Html.DropDownList using Jquery

I have a webpage with two radiobuttons and a dropdownlist as follows: <div class="sectionheader">Course <div class="dropdown"><%=Html.DropDownList("CourseSelection", Model.CourseList, new { @class = "dropdown" })%> </div> <div class="radiobuttons"><label><%=Html.RadioButton("CourseType", "Advanced", false )%> Advanced <...

Checklist for Embedded Windows Media Player

Is there a list of the things to check to get an embedded WMV video to playback? I have used the jQuery http://malsup.com/jquery/media/ Media Plugin which should make the embedded code correct for all browsers. However some corporate users report that they see the embedded video player but cannot play the file. In this case, users are ...

jQuery Autocomplete plugin (Jorn Zaefferer's) - how to dynamically change the list of displayed values?

I'm using Jorn Zaefferer's Autocomplete query plugin, http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/ I have options set so it shows all the values when you click in the empty text field, a bit like a select, and the option is also set so that the user can only choose from the list of values used by the autocomplete (so...

jQuery efficiency question

I have HTML like this: <div id="best"> <img src="image.jpg"> <span>title</span> <img src="image.jpg"> <span>title</span> <img src="image.jpg"> <span>title</span> </div> I want jQuery code to remove all spans. Which is best: $('#best').find('span').remove(); or $('#best').children('span').remove(); or $(...

Change URL Submitted to Depending on Form Selection

I have a form which I need to submit to one of three different URLs depending on a selection made in the form. I suspect the easiest solution is to use jQuery to insert the appropriate path before the rest of the form parameters as the selection is made, but not sure on what the code would be. Any pointers greratly appreciated! <form i...

jQuery: How to write a function on click, hold and move?

I started learning jQuery just yesterday, and I like it very much. And now I decided to write a script where I can change the margin-left of an image when I click on it, hold the clicking and move the mouse. Depending on mouse coordinates I must change the image's margin-left. Could you give me an idea how I can do it? Thanks. ...

loading HTML fragments with jQuery

Hi everybody, I'm very new to jQuery, Ajax and things like these. I've found solutions on how to inject HTML fragments into my site: $(document).ready(function(){ $('a').click(openContent); //binding all anchors to this function }); function openContent(){ var path = $(this).attr('href'); $('#content').load(path); retur...

Event bubbling with img tags?

I did some googling and figured I'm probably experiencing so called "event bubbling" that I've never heard of but are not surprised by it's existance. I want it to fire only once and I'm wondering how to fix this. Basically, I have this small code snippet: $('.bggallery_images').click(function () { alert('test'); }); ...

Removing all Matching Classes in jQuery

Hi I have an li element that will have something along the lines of this for a declaration <li class="module ui-helper-fix"> And I can dynamically change the color of the module by adding on classes (That are provided dynamically through DB calls) the end result being <li class="module ui-helper-fix module-green"> or <li class="m...

Best way to handle JSON timeout

Currently I am pulling a JSON feeds from numerous APIs using jQuery, but what is the best way to handle the possibility of a service not responding or timing out because of their server? Would it be better to cache the JSON on your server? I'm using PHP/MySQL so I'd like to see an example if a server-side solution is the way to go. ...

Issue with DOM manipulation (blockUI or alert()) during a onchange request - prevents other event from firing.

EDIT: I wrongly assumed this was caused by blockUI(); I was using Firebug's console.log to log the message but for the example here I changed to alert so you wouldn't need firebug to replicate. Once I tested it again, I was able to remove blockUI and the onclick didn't fire not firing. The issue seems to be whenever the DOM is changing...

jQuery: Scroll the window then addClass() - how to callback

Inside a jQuery event handler, I would like to scroll the window and then add a class to something. This is my code: $('#foo').click(function() { window.scrollTo(y); $('#bar').addClass('active'); }); $(window).scroll(function() { $('#bar').removeClass('active'); }); Notice I have another handler to remove that same ...

How to load jQuery if it's not already loaded?

Hi I'm working on a weather widget, so in order to optimize it i want to check if jQuery has been loaded in the page, if Not, the widget will load it from my website. Because not all the websites use jQuery. how to do that? Example of how to put my widget: <html> blah blah blah ................. <script src="http://www.xxx.com/weather...

JQuery Delegate and using traveral options in function

I am having trouble figuring out how to use the JQuery delegate function to do what I require. Basically, I need to allow users to add Panels (i.e. divs) to a form dynamically by selecting a button. Then when a user clicks a button within a given Panel, I want to be able to to something to that Panel (like change the color in this exam...

JavaScript/jQuery - onhashchange event workaround

Until all browsers support the onhashchange event what is the best workaround for this? Is there something for this in jQuery? or as a plug-in? ...