javascript

How I get the Railscasts episode "#229: Polling for Changes" to work with a nested route?

I have a rails 3 application very similar to the one in Railscasts episode #229 the only difference is that in my code Articles is called Posts and I have a nested route: routes.rb: Myapp::Application.routes.draw do resources :posts do resources :comments end root :to => "tags#index" end I receive this error in the terminal...

Help regarding the XML schema validation in JavaScript

I am currently working on a scenario where I am converting an input flat file (.txt) to an output XML file using JavaScript. I might have a requirement to validate that output XML file against a 5000 lines XSD. So, could someone please help me with the advantages or disadvantages of doing a schema validation within a JavaScript functio...

Sanitize HTML data.

I'm fetching data from different RSS / ATOM feeds and sometimes the HTML data I receive contains HTML tags but they dont have close tags or some other issues and it screws up the page layout / styling. Somethings there is class name / id clash. Is there any way to sanitize it? If anybody can point me to some reliable Javascript / Java ...

Can I get a walkthrough on this Code

I am trying to learn jQuery and I posted a question asking for some help on a topic. Someone kindly helped me out and I highly appreciate it. I just want to know if someone can help me understand what the different parts of this is doing $(".gradeA, .gradeU").find(":checkbox").click(function() { if (this.checked === false) { return;...

Javascript lightbox component that works with arbitrary HTML

Is there a Javascript component that allows me to simply pass it a string made up of arbitrary HTML (any HTML I wish to use) and will show that HTML in a lightbox? I've been scouring the internet, searching for examples, but it seems like there simply isn't any component capable of doing this. Even LightWindow, which claims to be all-...

Why is indexOf not working in Internet Explorer?

This function executes during the forms onSubmit, and works fine in Firefox and Chrome, but not in IE. I suspect it's indexOf, but I cannot seem to find a way to get it to work. function checkSuburbMatch(e) { var theSuburb = document.getElementById('suburb').value; var thePostcode = document.getElementById('postcode').value; var array...

JavaScript and SEO. How Should I reconcile them?

According to some SEO experts and theories like Progressive Enhancement (PE), page content should be presented appropriately to users even with JS disabled. And I totally agree with this. Here is my situation, on our client's About Us page, there is a div which lists their company events. Due to space and another considerations they hi...

I get an undefined error in firebug , even if I can see the value exists!...why??

i'm loading in jquery a google map json and i receive correctly the json object called 'data' sometimes — i can't identify exactly when or why and that's why i came here — even if i receive the regular values, BUT firebug console reads it is undefined! for example, I have this line below in my js: console.log(data.Placemark[i].Addre...

replace content of div without changing size or scrolling

Hi all, I'm trying to write some code which replaces old content with a placeholder while new content is loaded (via ajax). <div id="target"> ... </div> During the ajax request-response cycle, i'd like to replace the content of the target div with a 'loading' message or image. So far, this is simple ... However in some cases the ta...

I can't get my popup to stay up after hovering over it, using jQuery. What am I missing here?

Hi, I'm new to jQuery, but have been working with javascript and DHTML for several years. Trying to transfer over my knowledge of that to jQuery but have run into a snag. When hovering over a div, the popup comes up fine. If you leave the initial trigger div, the popup goes away - great. The problem occurs when I move off the trigger ...

Highlight and Edit XML in a browser

Trying to provide a user with editable XML page in a browser. For example, the following is part of an XML. <Employee name="John Doe" type="contract" ID="1000"> <Salary>10000</Salary> <Email>[email protected]</Email> </Employee> When the above is presented to the user in a brower (either IE or FF), the user should be a...

When textbox is resized in IE, block position behavior is messed up

Hi folks, i am using the autoresize plugin which increases the height as users type in stuff. It works great on FF/Chrome, but the behavior is messed up on IE (see screenshots below). Essentially, the textbox, when resized, does not push the rest of the buttons down, which is weird, given that nothing on the page is absolute positioned....

jQuery Lava Lamp Navigation Problem in WordPress

Hi, I've implemented a lava lamp style navigation menu (from here) to work with my WordpPress blog's navigation menu. This function needs to select an id or class for the navigation menu link it is supposed to hover over. I set this up in the function's code to select <li class="current_page_item">, which is a class applied by WordPress ...

Does using javascript:history.back(); have any unknown issues?

In my website I've two pages called First.aspx and second.aspx. From first.aspx I'm redirecting user to second.aspx clicking upon a link. In second.aspx page, I'm using javascript:history.back() on click of a cancel input button (not asp button). This is done to avoid reloading of last page as user has not done anything on this page, a...

How to count the number of <li> returned through ajax using Javascript?

I have a ajax code which returns the list items as <li>one</li> <li>Two</li> Each time it will return different number of <li>'s. I want to check the number of <li> it returns. How to check it using Javascript. Please Help. ...

redirecting to next page

I wrote a javascript function to go to a particular page if it came from a particular page. Function: function proceed() { if( document.referer == "http://abcd.com/index.php?action=SignUp") { return document.location.href = "http://abcd.com/editprofile.php?action=editprofile"; } } Submit button for a form in current page(b...

Create Dynamic span

How to highlight a content located at specific location ? I want to highlight a contents by location. for example I have a location value (x,y)=(0,312).Then how to highlight that contents by using js/jquery ...

FullCalendar: Change agendaDay background-color..

Basically, I just want to be able to color the background-color of the TD from a certain range.. Say I have my calendar that has slot minutes every 15 minutes and from 9am to 9pm, I would like to only color differently 10am to 3pm. This information would be coming from a feed but that is not an issue. I haven't found the TDs relating t...

window.onload vs document.ready

what is the difference between window.onload and document.ready. ...

Fullcalendar Add Event

Hey, I need to switch from jquery weekcalendar to fullcalendar and I am having troubles with understanding of adding new events. In weekcalendar its easy, I trigger the addEvent functions, open the dialog box and there I have my form and save everything ok with ajax. I also have a selectbox where are all times from the settings of first ...