javascript

jQuery check if event exists on element

Is there a way to check if an event exists in jQuery? I'm working on a plugin that uses namespaced events on made up events, and would like to be able to check if the event is binded to an element or not. ...

Fun project -- can you hook flash?

So my wife is hooked on playing bejeweled on FaceBook. Whenever I watch her play (and she's pretty good) I think man I bet I could write a pretty sweet algorithm that would put up a really good score. So more than anything, I guess I need to know, if there is anyway to observe the UI hooks in Flash from either in the browser with JavaS...

getting nodes without texts.

$("br").parent().contents().each(function(i) { if(this.nodeType == "#Text") { alert(this.textContent); } }); i am trying to select all texts not surrounded by html tags, but separated via <br> doing this, sometimes returns a lot of alert messages, even when there should only be a couple. i have tried to filter it ...

Javascript asynchronous request NOT working.

This code only works when async is set to false, why? var contact = { XMLHttp : null, XMLDoc : null, TXTDoc : null, getData : function(dataSource) { contact.XMLHttp = new XMLHttpRequest(); contact.XMLHttp.open("GET", dataSource, false); contact.XMLHttp.onreadystatechange = contact.storeData; contact.XMLHttp.send(null); }...

javascript variable into php

hi to all I have a php function, in this function I have a javascript which get the value of my element from parent window. My problem now is, how can I pass this value into php variables Any help would greatly appreciated. Thanks Tirso I tried this code but I got value always 1 here is my code function do_upload() { $categories...

Get contents of link tag with javascript?

Has anyone had luck getting the contents of a stylesheet loaded with a tag? ...

jQuery: hijack a link and find its parent

I know how to hijack a link in jQuery, and I know how to find an element's parent, but I can't seem to combine the two. I have multiple divs, each of which contains a link. I want to hijack the link and update the parent div's content. <div class="container-1"> <a href="/foo.html">Add content</a> </div> <div class="container-2"> ...

Issue with binding in jQuery for copied elements

This is actually a bigger question because I know there are several ways to solve this problem but I will try to sum it up. What I try to do: I am using this jQuery plugin to upload files via Flash http://www.uploadify.com/. However, the element #fileInput that I supposed to bind this function to is a live element which is generated aft...

How to make swappable div 'ui cards' with jQuery?

For example if you had a wizard that had step by step directions asking for information, each div would have the controls needed for each step (only one div shows at a time). Then you would swap through them one by one, hence going through a multi-step process all in one page load. Is this pretty easy to do in jQuery? Could you have one ...

Including JavaScript file into main document

Hello, I have a jquery-code which using selectors (from current document). Now I want to move this code into another file(js) and just include from this document. Could I do it without any editing? So, will jquery-code works right? ...

Using JavaScript to truncate text to a certain size (8 KB)

I'm using the Zemanta API, which accepts up to 8 KB of text per call. I'm extracting the text to send to Zemanta from Web pages using JavaScript, so I'm looking for a function that will truncate my text at exactly 8 KB. Zemanta should do this truncation on its own (i.e., if you send it a larger string), but I need to shuttle this text a...

OnChange problem with select_tag with '/' and '.' characters in Rails

I have an select_tag (rails) that loaded a select value with '/' and '.' character in it. The select tag's onchange redirects the page (using window.location) using concatenated url with the value of the select tag. These are the things I tried to isolate the problem. Invokes alert javascript to show the concatenated value. Added url...

Generate an SWF from an ActionScript source automatically, to be called from JavaScript

I have some data-crunching code implemented in ActionScript, and I'd like to call it from JavaScript. The related question http://stackoverflow.com/questions/460242/interacting-with-actionscript-2-0-using-javascript mentions the blog post http://blog.circlecube.com/2008/02/01/actionscript-javascript-communication/ which tells me how to d...

Loading flash videos into div with ajax

Hi, I have a client that wants to be able to select from a playlist of video thumbnails and it replaces a video that is on the page already. I also need to watch loading times, so thought it would be better requesting each video if and when it's clicked with ajax? I'm new to ajax so not really sure if this is the best option. My page i...

Help with simple javascript php/js array

Can someone please tell me what's wrong with this code? Basically what I am doing is creating a php array for some GET variables. Then, I create a js array from that php array and pass it to a js function. The problem is that the function is not being called. I don't get to see the "hi" alert pop up. <script type="text/javascript"> fun...

Searching algorithm

I'm looking for a efficient searching algorithm to get the longest shortest repeated pattern in a collection (~2k of integers), where my collection is made of this repeated pattern only (there is no noise between repeated patterns), but the last occurence of pattern may be incomplete. Examples: I've got: [2,4,1, 2,4,1, 2,4,1, 2,4,1, 2,4...

How to hide wmd editor initially?

<div style="display:none;"> <div id="wmd-editor" class="wmd-panel"> <div id="wmd-button-bar"></div> <textarea id="wmd-input"></textarea> </div> <div id="wmd-preview" class="wmd-panel"></div> <div id="wmd-output" class="wmd-panel"></div> </div> See,I'm following wmd-test.html of derobins-wmd,except put that st...

How to implement the orange color when you follow a permalink?

Like what you see when following this link: link text It's cool! ...

Detect when link is clicked, open in new frame

I would like to create a basic URL rewrite using frames. I don't have access to .htaccess to do mod_rewrite. Is there a way using PHP, jQuery, JavaScript etc. to detect which URL has been clicked on and then open URL in new frame? Ex: user clicks on /index.php?12345 it will open in framed window /pages/12345/index.html and if they cl...

How do you add the values from input fields and update another field with the result in jQuery?

Preamble: I'm more of a PHP/MySQL guy, just starting to dabble in javascript/jQuery, so please excuse this dumb newbie question. Couldn't figure it out from the Docs. I have a form without a submit button. The goal is to allow the user to input values into several form fields and use jQuery to total them up on the bottom in a div. The f...