javascript

Set number of rows based on not letting the page scroll (jquery)

We have a page with multiple content areas, in one of which we build a table from a result set. The user requirement is that the page not scroll. If we fix the number of rows to now allow scrolling at our preferred screen resolution, it looks great at the preferred resolution, but at lower resolutions the page scrolls. If we fix the n...

jQuery .html not working on td

I have a table cell with a text box in it, and I'm trying to take the value of the text box and put it back into the table cell while removing the text box. I'm doing this for a while row. So I have this: tds.each(function(i) { var val = $(this).children('input').eq(0).val(); document.getElementById($(thi...

How To Insert a New Div Which Surrounds Existing Elements

Given this markup: <h1>Lorem ipsum!</h1> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. </p> <p>Aliquam erat volutpat.</p> How can I surround the two existing paragraphs with a new div using JavaScript? Desired outcome: <h1>Lorem ipsum!</h1> <div> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. </p> <p>A...

Fading out and in with $(this).parent().find() repeating.

Hi there, I've been creating a checklist webapp using JQuery, and so far it has been going pretty smooth, but now I'm trying to make editable content. I want to do this by fading out the text in the list, and fading in the textbox, and then reverse when complete. The checklist can be found here: The Checklist. As you can see it is fairly...

How to load a partial inside of a partial?

I'm trying to fire an AJAX request when my page loads. I'm guessing this would be best from my controller. First I open a new page.. def text_tabs_nav end This page has the ability to load by AJAX two different partials. I want to load one of them on default. So I thought maybe this .. def text_tabs_nav respond_to do |format| ...

chain of dynamic external javascript calls

I'm not exactly sure how best to phrase my question, so I'll start by explaining what I am trying to do. I have a page that has some code similar to a Google Analytics pixel code. Something like this: <div id="mydiv"></div> <script src="blahblah.php"></script> The PHP script returns some javascript that will insert another snippet i...

JavaScript and .js file ending, Strict Requirement for externally referenced pages?

Is the .js file ending a strict requirement for externally referenced JavaScript pages? I have not run into issues with IE6,7,8 and FF3.5 in testing but wanted to confirm. I have an architecture limitation leading me to this question. ...

changing string to a function in javascript (not eval)

var foo = "function (){ alert('meee'); }"; foo(); I have tried the above but it does not work is there any other way to execute that function without using eval? thnx ...

Make element fade away then display:none;

I have an element that fades in, its the size of the page and goes over top of the whole page. when you click the close button it should fade out. I have this all working but my issue is when I close it, its opacity is set to 0, but you can still click what was in the element. (I have a couple a tags in it) So.. your clicking it even th...

Iterating through a Dictionary to add to another

I am trying to loop through each value in my dictionary and then go out and get another dictionary based on one of the objects in the first dictionary through each loop iteration: var dAlbumPhotos = {}; // holds a list of photo objects var dAlbumsAndPhotos = {}; // will hold all the album | dAlbumPhotos for each album for(var a in dAl...

How to post to user's wall when user is offline.

Hi, I have just used the javascript sdk to publish to the wall when the user is online. I am starting to like it. Now I want to post to wall when user is offline. I already have extended permissions from the user. How can I post to user's wall when user is offline using javascript sdk. here is my code: function Publish(body){ ...

jQuery UI modal dialog form using remote content

I have a form in a web page dynamically generated and I would like to display it using a the jQuery UI modal dialog. How can I display the modal dialog form with the remote existing form (myform.html) as content when I click on a link "Open Form"? Clicking on submit button should close the dialog form. ...

Sharepoint Custom WebPart Startup Script

Okay, I've gotten a unique issue I've been trying to solve for two days. I have System.Web.UI.WebControls.WebParts.WebPart control I am building a custom Sharepoint View with. Almost everything I want done is working except one little issue. I need to use Javascript to Format Date and Currency fields. The Client wants DateTime field...

Javascript to socket server conneciton

Hi! I wanted to create a web chat. It was suggested that i use Php Socket Servers. I've made one and they function well with a telnet client. What i find myself bamboozled by is how to get that data to the client via ajax (no page refreshes). All I can come up with is calling a php file with ajax, getting the data and updating the page....

Updating address bar with new URL without hash or reloading the page

I either dreamt about chrome (dev channel) implementing a way to update the address bar via javascript (the path, not domain) without reloading the page or they really have done this... However...I can't find the article I think I read. Am I crazy or is there a way to do this [in chrome]? p.s. I'm not talking about window.location.has...

Chrome's changing height when loading pictures - how to get actual height with jQuery on load

I have the following: var offset = {top: target.offset().top + target.height() + 3, left: target.offset().left}; target.offset(offset); this happens on $(document).ready(..) However, in chrome, the target object is not positioned with the appropriate height. When I placed an alert(..) to show the actual height, I sa...

JQuery Pulsate - Weird behaviour with Firefox

I'm trying to pulsate some text using JQuery, which gives some jagged edges when using Firefox, I tried to isolate the problem, and it happens when I change the text color to red using CSS. It seems as if there are bits of black left. Works ok in other browsers, even IE, so I'm a bit confused now. Here's the code: <head> <script src="ht...

Retrive JSON data by index

Hi, I am using PHP json_encode to generate JSON data of a shopping cart : {"6cb380f1bfbcd7728be7dfbf2be6bad4":{"rowid":"6cb380f1bfbcd7728be7dfbf2be6bad4", "id":"sku_131ABC","qty":"4","price":"35.95","name": "T-Shirt","options":{"Size":"M","Color":"Red"},"subtotal":143.8}} As you notice the initial ID is unique and not predictable. I...

jQuery image picker

I'm looking for a jQuery image picker plugin that allows me to do the following: Display a group of images and let the user select one (and only one) by clicking it If the user does not like any of the specified images, he should be able to upload his own Just #1 would suffice, as I can add the code for #2 if necessary It's not that...

How to distinguish between live and non-live NodeList collections?

Both document.getElementsByTagName('div') and document.querySelectorAll('div') return NodeList collection. The only difference is that first method returns live-collection and second one - a static one. The question is - is there any opportunity to distinguish one object from another only via inspecting these objects (i.e - not trying t...