javascript

obtaining the value of a select dropdown from within a function

I have a method of an object called update that generates an integer, and if it's different than the value of the region variable, assigns it to region. If the integer is the same as region then the user selects a value from a <select> dropdown menu. I'm trying to figure out how to get the value of the <select> into the function. <for...

Full width image carousel that can center selected image and partially show other images in gallery

Hi, I've looked for a plugin that will do this and the closest I could find was CarouselLite but it doesn't really do what I am trying to get. Most of other libraries I could find don't like 100% width or hide inactive images or don't center the active image scrolling it to the very left of the gallery div. I'm not really good at javasc...

jQuery: animate( params, [duration], [easing], [callback] )

It looks like callback function is executed right after animate is called, not at the end of the duration which that animate is set to. And it looks like it does not matter where the function is executed within or referenced. is there a way to specify to fire up callback function at the end of duration, or i need to initiate a timer whi...

easier bookmarklet development

Here's how I make develop a bookmarklet: I write a javascript function, pass that to Bookmarklet Builder to make a bookmarklet, add the bookmarklet to my browser, load my test webpage, test the bookmarklet, and then something doesn't work, so I try to find what's wrong and change my javascript function accordingly and the tedious cycle s...

Running JS inside a fancyzoom box

I'm trying to run Javascript inside of a fancyzoom modal box, but it's not working. I'm not a JS expert but my theory is that because fancyzoom moves the target div's content to a completely different area of the markup, something's getting messed up in there. For instance, I have my Uploadify queue/uploader inside a Fancyzoom box, but ...

AJAX Controlled Multiple Select Box Strategy

I've done some reading on AJAX, and would like to create a listbox, that controls what is displayed in a separate textbox located within the same form. The backend of the website is handled in php, and the possible values and whatnot is stored within the MySQL database via php. What's the best way of obtaining the listbox values as well ...

Interacting with the JavaScript scope chain

Given the following snippet of javascript in a scope: var x = 10; function sayx() { alert(x); } sayx(); You would of course expect a message box printing '10', you could do multiple function nesting to interact with how 'x' is determined, because when resolving what x is the environment walks up the scope chain. You can even do a...

jQuery queue messages

Hello, I've got a short function that should show messages on a website. function showHint() { $('#notify').html('message text').show('slide', {direction: 'right'}, 500); } And there is another function that hides the messages. function hideHint() { $('#notify').hide('slide', {direction: 'right'}, 500); } The Problem i...

Number of days in any month

JavaScript function that accepts a number from 1 - 12 representing the months of the year, and then returns the number of days in that month? ...

How might I use jQuery to show the first 8 elements?

I have a list of items (<li>), something like 50 of them, and I want to show only the first 8 items... How can I do that? ...

IE support for DOM importNode

I've been looking arround the web, and I'm fairly sure I already know the answer ("no"), but I'd like to check: Does IE support importNode() yet? Is there a better alternative than walking the DOM and creating nodes? (I've seen the clasic article by Anthony Holdener but its more than a year old now, and I'm hoping that either IE has evo...

AspNet ViewState piece showing on the page with Google Chrome

Im not sure why is this happening but there is a piece of viewstate being shown on the top of my page with its closing tag. I believe is just happening when there is some javascript code in the page, but is quite odd because has nothing to do with the ViewState at all. Anybody knows anything about this? Thanks, Leonardo ...

Using javascript to do a POST in rails

So I'm using this plugin: jquery-in-place-editor, I'm trying to make a POST request according to the docs, but I'm not sure what URL to do the POST to, I can't seem to get it right. If I'm in the show view for the object, which in this case the path is: /quote_line_items/90 But when the script executes I get this error: No action respo...

Convert string into jQuery object and select inner element

I wonder if there is a way to convert string into jQuery object and select inner elements without injecting the whole string into DOM and manipulate it in there. Thanks. If possible, please give me example of converting <div id=a1><//div> <div id=a3><//div> And select a1 from the object variable Thanks ...

problems getting the values of a select element-

struggling to get the value of a selected item html- <select name="recommendFriend" onChange="friendWall(127);return false;" id="recommendFriend"> var user = document.getElementById("recommendFriend").getAttribute("value") im using JS on facebook ...

PRE tag to Plain Text

I am making a site where code will be displayed as plain text in a PRE tag (no highlighting, comments, no edit tags) and the I want them to be able to click a button and have the highlighted, commented and edit tag code to appear (also in a pre tag) . Obviously I have to store the highlighted HTML code somewhere but I was looking for a ...

Classical vs Prototypal... how are they so different?

for example in PHP class foo{ function foo($name){ //constructor $this->name=$name; } function sayMyName(){ return $this->name; } } class bar extends foo{ function sayMyName(){ return "subclassed ".$this->name; } } And in JS function foo(name){ this.name=name; } foo.prototype.sayMyName=function(){return th...

extract html table information based on radio button checked

What combination of selectors could I use to get the html text that contains Price information in the example below. (Assume user has clicked a radio button and the Submit button) <table border="1" id="modal_table"> <tbody> <tr> <td> <input type="radio" name='sub' value="509"/> </td> <td> 509 </td> <td class='price'> Price is...

Javascript degradable cascading dropdownlists

Hi all, I have 2-3 list within a form that rely on each other. If one is changed an ajax call is made and the others are loaded. I was wondering if any of you knew of a method to make this dropdownlist js degradable. Thanks ...

with jQuery, access json from cross domain url where json may be poorly formed

I'm using jQuery's ajax function to hit a cross domain url. The url will return json. I'm in the discovery phase with this but I think, because the json values contain several '&quot' strings, the json eval is throwing an error and stopping the execution of my client side script. The error that I get is "unterminated string literal". I k...