javascript

Any way to update original page's input fields with lightbox radio button selection? (jquery, iframe)

Hi there - I don't know that this is actually possible with my current setup. There are three fields: Current pass, new pass, and repeat new pass. (By request) All I'm trying to get it to do is, when a user wants to update their password but enters identical info in the old and new pass fields, a lightbox pops up asking if they want to ...

Find the function calling the function in JS?

What's the best way to find the function that's calling the function? For example, if I have function first(){ doSomething(); } // Lots of code function doSomething(){ alert('Somehow, I know that' + ________ + 'function called me...'); alert('Boink, hit an error, but now you know what function called me'); } Is there any way ...

jQuery $.post fires twice?

I have this code, and for some reason my $.post function fires twice in quick succession (for 'journal/weather') according to Firebug. It still does this when I remove the "if (navigator.geolocation)", however, if I replace the $.post block with something like console.log('test'), it only fires once. What's even weirder is when I place...

Scroll page until some height

Hello, how can I scroll the page with javascript until the scrolled height will be some predefined number of pixels? function pageScroll() { // Next line is pseudocode: if (window.ScrolledHeight != SOME_NUM) window.scrollBy(0,50); } scrolldelay = setTimeout('pageScroll()',100); There should be some logical checking of s...

jQuery UI AutoComplete Passing input data

I am sure this has been asked a ton of times, but would appreciate some assistance. I am trying to setup the jQuery UI, which I can get a static result list with from JSON. But I need to pass my INPUT value onto the PHP script to that it can actually filter the results. My Code for the Input Field <input id="search" /> My Code for...

How can we send a HTTP POST request by using JavaScript?

How can we send a request using the HTTP POST method via javascript...without submitting a form? ...

Something like a Map<String, Object> I can use to store data in jquery?

Hi, I have some JSON objects I'd like to store in a map for the lifetime of my app. For example, my app shows a listing of Farms. When a user clicks one of the Farm links, I download a Farm representation as JSON: Farm 1 Farm 2 ... Farm N every time the user clicks one of those links, I download the entire Farm object. Instead, I'd l...

jQuery/JavaScript - Hide / Show Drop down box pending on Radio Button

Hi everyone, I want to make it so that the drop-down is only displayed when the radio button (option 3) is clicked and have it hidden if either 1 or 2 is selected. What would be the best way to complete this? I have a little bit of experience with JavaScript and slim to none with jQuery but it seemed like it might be the way to go. Than...

Javascript, Fire Function on click.

Hi, I'm new to javascript and I am attempting to create an element with certain html inside. This is my code: function newTask() { var newtask = document.CreateElement('li'); newtask.setAttribute('id','newtask'); newtask.innerHTML="DeveloperSnippets"; document.getElementById('newtaskcontainer').appen...

Determine whether webpage has foreground window focus/is active tab?

I'd like to be able to mute activity of my app if I can detect that the page is no longer focused. For instance, if the page is in a background tab or another app has focus, I'd like to disable a constantly polling script or switch modal notifications to the new HTML5 notifications API. Is there any way to get this with JS, and if so, w...

How to replace all empty <img src=""> on a page with JavaScript on dom loaded?

Hey everybody, I need a function, that starts, when the DOM is loaded. In my HTML Page are several empty Image Tags, like and I want to add an Image-Name into the src-property when everything is loaded to get something like <img src="blank.jpg">. Best wishes Chris ...

GreaseMonkey Log In Script

I've been trying to figure out how to write a greasemonkey script to log me into a 401 html page. When I'm asked for a username and password in a pop up box (401 Request I believe), i want it to automatically log me in (my company's design sites are all the same username and password). Any help? Also, save passwords won't work because...

What does three semicolons in a javascript expression do?

I've seen a triple semicolon in a few expressions here and there. Does it have any logical effect? The Closest thing I've seen for an explanation is that it tells the Dean Edwards compressor to ignore that line. ;;; var someVar = 'Rebel'; ...

Javascript select only text of an element not its children

Hello. Please consider the following HTML: <td> Some Text <table>.....</table> </td> I need to manipulate the "Some Text" text of td element. I should not touch the table element inside of this td. So, just for example, maybe I want to replace all "e" with "@". I tried a few approaches with jQuery's .text() and .html(). I seem...

Where does the "item" object come from in javaScript...

Messing with some javaScript, I found that the variable name "item" was already being assigned before I declared it or assigned anything to it. Tracing it backwards, I found that it even seemed defined before I did ANYTHING in js. To verify this, I even put <script>alert(item);</script> on a line by itself IMMEDIATELY after opening ...

Desktop/OS User Agents in Javascript

Below is my current script: <script type="text/javascript"> if (navigator.userAgent.indexOf('BlackBerry')!= -1){ document.write('<link rel="stylesheet" href="/m/css/mobile.css" type="text/css" />'); } else if (navigator.userAgent.indexOf('iPhone')!= -1) { document.write('<link rel="stylesheet" href="/m/css/smartmobile.css" type=...

Javascript click through element

There is a semitransparent overlay div covering document which destroys on click, but I need somehow to trigger onlick events of the element beneath overlay at the same time. Is there a way to click on specific coordinates with JS, or maybe determine underlying element having absolute x and y positions? Thanks. ...

coda question on javascript

I have a quick question on Coda. Not sure if this for this website but i'm sure someone here will tell me. Does Coda have javascript error recognition like dreamweaver does or is there a plug-in for it. I keep having to switch dreamweaver to test stuff and I'd really like to stop doing that. Thanks. ...

How to change option value with Jquery?

I am looking for a way to change the option value from a select tag when users click on a link. For example I have a select option html: <select> <option value="0">Please Select</option> <option value="1">red</option> <option value="2">white</option> </select> And I have 2 links <a href="#" title="red" class="preview_link">red</a>...

Text to HTML in SharePoint using Javascript

I have a summary single-line text column in SharePoint 2007 that is a truncation of a multi-line text column. Going through the complicated process to get there, it turns into text which then needs to be converted back to HTML, so that the tags like <div> don't show. The following code works if the multi-line column is rich text, but n...