javascript

How can I tell when changes to jquery html() have finished ?

I'm using jQuery to change the HTML of a tag, and the new HTML can be a very long string. $("#divToChange").html(newHTML); I then want to select elements created in the new HTML, but if I put the code immediately following the above line it seems to create a race condition with a long string where the changes that html() is making may...

JQuery not Working in chrome?

Hi everyone! I have some code here which works perfectly in firefox but not in chrome or IE, my javascript is thus ` $(document).ready(function() { $("#clientLoginPop").show(); $("#clientLoginPop").animate({"left": "-=400px"}, "fast"); }); ...

Would anyone tell me how to fetch the media:thumb element's attribute from a json feed?

I made a yahoo pipe that pulls up the atoms as json format; however, I can fetch and display all the elements in my html page except for the element's attribute. Would anyone tell me how to fetch the media:thumb element's attribute from a json feed? I am pasting the html page's code with javascript. If you save the html page and then ...

Read a local file

Hi, Is there no way for javascript hosted on a webserver to read a file on a client's local machine? (this has obvious security risks). I guess I'm wondering if there's any access granting a user can do, like drag and dropping a file into the browser, or explicitly selecting a file from a popup to get around this? I know flash 10 allow...

Disable resizing tables in mozilla in design mode

Is there a way to remove the attribute '_moz_resizing="true"' added by Firefox from <TABLE> to avoid giving user the possibility to resize table in design mode (when contentEditable=true). ...

Open source interactive color theme chooser

I would like to give my users something similar to crystallines color chooser or themeroller so they can interactively theme the site. Is there an open source solution that would go most of the way in this respect? Short of that what color picker would you recommend? ...

How to store and access ajax data in javascript without using global variables ?

I may be missing something obvious here, but how could I rewrite this code so that it doesn't need the theVariable to be a global variable ? <script language="javascript"> theVariable = ""; function setValue() /* called on page load */ { /* make ajax call to the server here */ theVariable = "a string of json data waiti...

Syntax highlighting with Chili

I want to use jquery Chili plugin for syntax highlighting a piece of code thats generated on the fly, but its not working for the same, because the code is inserted into the #output div on page load. When I tried chili with static examples, it worked but not on the dynamically generated code. Is there any workaround? Thanks in advance ...

Best practice for defining CSS rules via JavaScript

I'm loading a stylesheet that is only required when javascript is enabled. More to the point, it mustn't be present if JavaScript is disabled. I'm doing this as soon as possible (in the head) before any javascript libraries are loaded. (I'm loading all scripts as late as possible). The code for loading this stylesheet externally is simpl...

How to call a JavaScript function from one frame to another in Chrome/Webkit with file protocol

I have developed an application that has a list of items in one frame; when one clicks on an item it does something in another frame (loads an image). This used to work fine in all browsers, including Chrome 3; now it still works fine in Firefox but in recent versions of Chrome (I believe since 4) it throws this error: Unsafe JavaSc...

javascript regular expressions

hi, how can i not allow these chars: \ / " ' [ ] { } | ~ ` ^ & using javascript regular expression pattern thanks a lot ...

How to correct character encoding in IE8 native json ?

I am using json with unicode text, and having a problem with the IE8 native json implementation. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script> var stringified = JSON.stringify("สวัสดี olé"); alert(stringified); </script> Using json2.js or FireFox native json, the alert() string is the same as...

Sticky/static variable references in for loops

In this example I create three buttons 'one' 'two' 'three'. When clicked I want them to alert their number: <html> <head> <script type="application/javascript" src="jquery.js"></script> <script type="application/javascript"> $(document).ready(function() { var numbers = ['one', 'two', 'thre...

Is there a difference between long-polling and using Comet

I am implementing a system where I need real-time updates. I have been looking at certain scenarios and among all was Comet. Implementing this I do not see any way this is different from traditional long-polling. In both cases you have to send a request, and then the server send a response back. In the browser you interpret the response...

How to deal with JavaScript when trying to fetch web page in C#.NET/WPF?

The .NET WebClient class is nice and all, but it doesn't parse the JavaScript in the page. What I mean is, sometimes a page is forwarded to a different page via JavaScript, or sometimes DOM elements get added to the page via JavaScript with an onload event. I need to deal with both of these situations. What can I do to deal with this?...

How to print a full content of JScrollPane?

I am just a designer and don't know javascript well enough to figure out how to print a full content of a JScrollPane, not a visible part of it. I would very much appreciate any help with the issue. Thanks! ...

transfer event from one dom to other dom in javascript

In javascript, let say I got two nodes(node A, node B). when I click on node A, can I transfer "click" event to node B, so event handler for node B will execute. ...

IE6 Hover Issue

Hello, As you guys know, the CSS :hover doesn't work in d.... IE6 for an element except for links. What is the fix for that. I mean how do I apply the :hover to a div for example. Any fix/alternative/solution? Thanks. ...

jQuery event that triggers after CSS is loaded?

(I posted this on the jQuery forums but it's still awaiting moderation, so I thought I'd try my luck here since Stack Overflow is so awesome. If I get an answer I'll post it here.) I have a couple of links on my page (inside a <div id="theme-selector">) which allow you to change the CSS stylesheets: $('#theme-selector a').click(functio...

CSS or JS to hide an INPUT but keep text displayed ?

Is transparentize border, background one by one is the only way? Any other method? And how to hide the dropdown icon of a SELECT input? ...