javascript

Is there a preferred way of formatting jQuery chains to make them more readable?

Given this following sample code which clones a table row, sets some properties and then appends it to a table: $("#FundTable").append( objButton.parents("tr").clone() .find(".RowTitle").text("Row " + nAddCount).end() .find(".FundManagerSelect").attr("id", "FundManager" + nAddCount) .c...

Generate random element position and prevent overlapping in JavaScript

I have a holder div on the page where I want to load small images in on random position as a collage with 10px padding on each. How can I make sure that images never overlap each other or holder div? Is there a plugin or function that I could use? My code so far: <script src="jquery-1.3.2.min.js" type="text/javascript"></script> <sc...

how to detect iframe iframe resize

is there a way to detect if content of my iframe has change... my work around is i have a loop which constantly check for the height of the content it effective but not efficient is there another way of doing this? thanks, ...

Save temporary Ajax parameters in jQuery

Hi there, I am developing a heavily scripted Web application and am now doing some Error handling. But to do that, I need a way to access the AJAX parameters that were given to jQuery for that specific AJAX Request. I haven't found anything on it at jquery.com so I am asking you folks if you have any idea how to accomplish that. Here i...

jQuery UI Draggable snap rulers

I am setting up a drag and drop interface using jquery and jquery-ui. I've got element snapping working, which is nice, but now I'm trying to get elements to snap at a distance, using some sort of automatic temporary guide rulers. A very good implementation is on the mac version of Powerpoint. Here's a screenshot of a drag in progress: ...

Why are my property get_ and set_ not exposed in an AJAX Control?

I'm trying to create an AJAX control and I'm unable to see the property get_ and set_ methods within the control. This is code I've got in my .js file: Type.registerNamespace('MyCompany.ControlLibrary'); MyCompany.ControlLibrary.WebNotify = function(element) { // Module level variables this._message = ''; //Calling the ba...

Javascript to modify all absolutely positioned elements

Hi Effectively what I need to do in JS is move all absolutely positioned elements down by x pixels. Do I need to loop through every element and try to figure out if it's positioned absolutely? Or is there a better way? Thanks, Mala Update: specific: I am using a bookmarklet to inject JS onto any page - thus I cannot change the markup ...

jquery flot: display all data and Y axis hover

Greetings I am a jquery newbie and trying to fix an issue which uses a version of "turning-series.html" from the official flot examples, 1- I am wondering how can I swith it from display selected to display all from my datasets. 2- How to change my options so when mouse over the point, it displays the value of the Y axis ? //My data ins...

Can it be disadvantageous to store jQuery objects in a variable?

I've just recently asked the folloiwng question with regard to jQuery chaning: http://stackoverflow.com/questions/1286829/is-there-a-preferred-way-of-formatting-jquery-chains-to-make-them-more-readable A number of people replied with the suggestion that maybe I reduced the amount of chaining within the statement, and instead stored obj...

[ASP.NET] Show/Hide Divs in a ListView

Hi, I have a ListView binded to a GenericList and for each Item it is creating this tr and td's structure: <tr> <td>Name</td> <td>Surname</td> <td>14/08/2009</td> <td><a href="#" class="trigger">Show</a></td> </tr> <tr> <td colspan="4"> <div class="showPicture"> <img src="" alt="" /> </div> </td> <...

AJAX uploading with PHP and Javascript

Hey, I want to dynamically send an upload form to CI via jQuery. The form needs to contain the file to be uploaded and the path to save to. So far my AJAX-call looks like this: file = $('#file').val(); path = active_dir; upload_file( file, path ); function upload_file(file, path) { $.post("/upload_file/", { file: file, path: path ...

JQuery - "highlight" effect help

Looking at the "highlight" JQuery effect: http://docs.jquery.com/UI/Effects/Highlight You can change the background color of any DIV to fade in/out However, the example is to "highlight" on a "click" event $("div").click(function () { $(this).effect("highlight", {}, 3000); }); How can I programatically call the highlight meth...

Using JavaScript scripting in Adobe Photoshop, how to change the contents of the selected text layer

Alternatively, how to change the contents of a TextItem by layer name. note: I'm using Photoshop CS4 (11.0.1) ...

Arranging elements on the screen and saving their positions

Hi, I want to build a tool (with HTML5, JS and CSS3), which helps customers to arrange elements on a website mockup (e.g. text blocks and pictures). I want to save the position of these elements in order to reconstruct the whole mockup website later. Maybe a grid system would be the best? I would be happy to get some ideas on approa...

Aborting A jquery getJSON XMLHttpRequest (UPDATED)

Turns out this was an artefact of a Firebug bug. The Ajax request was cancelled, but Firebug continued reporting it as active. Details here. I have long running XMLHttpRequests and I need to be able to abort them under certain circumstances. I set up the request in a normal way: ajax = $.getJSON(url + "?updates", function(data) { .....

How do I change an onmouseover event using Javascript?

I have an HTML span which changes it's class onmouseover and onmouseout: <span id="someSpan" class="static" onmouseover="this.className='active'" onmouseout="this.className='static'">Some Text</span> I want to be able to enable and disable (change) the onmouseover and onmouseout events using a Javascript function called elsewhere on t...

How to append text to a variable, within a function, in Javascript?

var err = ''; err += 'err a'; myString = 'Blah'; new Ajax.Request('/check_me.php', { method:'get', parameters: { 'string': myString }, evalScripts: true, onComplete: function(t){ var response = t.responseText; if (response == false) { //do nothing } else { err += 'err b.\n'; //alert(err); ...

jQuery Plugin Development - passing parameters to user defined callback function

Thank you all ahead of time. This is my first time developing a jQuery plugin (and first time developing in javascript as well actually), and I have to say I'm pretty geeked (It probably has many hideous things to you seasoned js/jquery developers, but this is my first attempt - please bear with me :). I welcome any constructive criticis...

Why doesn't IE8 recognize type="application/javascript" in a script tag?

I developed an HTML page that uses jQuery and Ajax. I had the following lines in my <head> tag: <script language="javascript" type="application/javascript" src="script/jquery.js"></script> <script language="javascript" type="application/javascript"> function someFunction() { some code; } </script> ... later - down...

What is the best way to detect/catch a change in font size?

I would like to catch an onFontSizeChange event and then do stuff (like re-render because the browser has changed font sizes on me). Unfortunately, no such event exists and so I must hack a way to do it. I've seen people do things like place an 'm' in an invisible <div> element and then test for changes in the size to the element. Does...