javascript

How to scroll a <li> while appending it into group of <li>

I have a Div Container which holds 4 <li> what I am doing is prepend a <li> into the <ul> and remove the last <li> I did that quite easily using $('#news-ul li:last').remove() $('#news-ul').prepend(str); //str contains a <li> I want to have scroll effect when the <li> is prepending. How to achieve this. Plz help me, any help will b...

How to replace entire HTML with external HTML?

Let's say I have this page (page.html): <html> <body> <h1>AAA</h1> <script type="text/javascript"> //<![CDATA[ $(document).ready(function() { $.get('page2.html', function(data){ // I want to replace the entire HTML with the HTML of page2.html // but this doesnt' work $('html').replaceWith(data); }); }); //]]> </...

jquery hide if html specifically = £

I have some code like this if ($('.lblpricefrom > strong').html() == '£'){ $('.lblpricefrom').parents("div.resultsitem").hide();} But it seems to be hiding items with the class lblpricefrom even if the html within = £456 I need it to only hide the items with the class lblpricefrom if the html within specifically = just £ and thats i...

Referencing javascript libraries locally or externally?

We are currently developing an ASP.NET MVC application which will be deployed on a corporate intranet, with a slightly-modified customer facing version available on the public internet. We're making use of a number of external javascript libraries (e.g. jQuery) and a discussion has come up regarding referencing the libraries - should we...

Find duplicates in an array and remove them out using javascript

how to find duplicates in an array and remove them using javascript? ...

How to select the inverse of the selection

I am successful in selecting the first <li> of the <ul> i want to select the remaining of the <li> except the current selected <li> . i.e., (inverse) How can I select it. Please help EDIT 1 As per request var newEle = $(str); //str contains a <li> i.e., <li>Some content</li> $(newEle).hide(); ...

Starfield in HTML with transparent background

Hello, I'm trying to get the background of a html5-starfield transparent. I'm not really a coder; but i think it's hard to do. http://www.chiptune.com/starfield/starfield.html http://www.thediscopalace.com/testing.php Using flash can be a solution but this is not allowed because it also must run on the ipad. Can somebody give me some...

Checkbox onclick javascript do not make the file upload element empty in IE

I have a checkbox and a file upload element, they both are dependent on each other such that if on is on that other has to be off(empty in case of file upload field) for this i have used the javascript on onclick of checkbox and onchange of file upload.. For onchange event the checkbox gets deselected in all browsers but after i sele...

AjaxFileUpload Plugin does not retrieve $_POST data

This is almost identical problem which I faced a few days ago. I fixed it then, but now it's not working any more. Well, some of it works. I'm using AjaxFileUpload Plugin to upload files in my WP plugin. This plugin calls uploader.php to process the upload form. I am able to get the filename (and other data) using $_FILES['uploadFile']...

How to convert a JSON-like string to a Javascript object?

I am getting a string like this: var json = "title: abc, link: http://google.com, size: 1"; How can I convert it to an Javascript object so that I can access it like obj.title, obj.link etc. This doesn’t work: var obj = eval("(" + json + ')'); //error How to achieve this? Here is the full code var entry = json.feed.entry[i]; //h...

How to access text from neighboring table cell?

I have a set of search results presented in a table. Each row has a radio box. Once the user has selected a row I would like to access the description text from the neighboring cell. Using jQuery or straight javascript, what is the best way to do this? <tr class="odd"> <td class="chosenCode"><input type="radio" value="123" name="chos...

JavaScript content-type

When I add JavaScript files to web pages, I have always done for example like this: <script type="text/javascript" src="/js/jquery.min.js"></script> <script type="text/javascript"> // Custom script </script> But today I discovered in the response headers that JavaScript are actually served as application/javascript. Why is that? I...

Bind jQuery hover event to multiple DOM elements

Hello, I've an unordered list of elements and I want to bind hover event to each of these elements. The HTML structure is as follows : <ul> <li id="url_1">item 1</li> <li id="url_2">item 2</li> </ul> I figured using a for-loop would be the best way to do it. So my jQuery code is as follows: for(i=1;i<=2;i++){ $("li#url_"+i)....

In jQuery, how can I monitor a dynamically populated element (AJAX), without basing it on an event?

I have the following markup on page load: <select name="sel_billing_address"></select> After page load that select is then populated by some AJAX to be something along the lines of: <select name="sel_billing_address"> <option value="1">hi</option> <option value="2">there</option> <option value="3" selected="selected">sally</opt...

Webpage performance IE only JS/CSS files

When we keep JS and CSS files for IE only with tags, do other browsers read it. I understand they ignore it but do they download all the files and then ignore it or vice versa. My reason for asking is page performance. ...

Sencha Touch do not set scale and allow scrolling and resize on iPhone or iPad

I am playing around with Sencha Touch, especially with examples like http://dev.sencha.com/deploy/touch/examples/ However I am faced with a problem, when using the component the scale is set on the iPhone and the user cannot scroll the page or zoom in or out. How may I disable these settings as I would like to have the carousel on a pa...

Scroll page to a certain point then start scrolling a div's overflow content using only one scrollbar

I'm after some information on how to make the page's scroll bar scroll the overflow content of a div instead of the page once its scrolled to a certain point. The end outcome is to scroll the page to the extent that the header isn't visible anymore, but from that point forward scroll the contents of the div - with the main scrollbar, no...

In what is the pip.io UI built?

Can anyone tell me if the http://pip.io UI is built in AJAX or only JavaScript? The reason I ask this is that I noticed the UI is scalable in the browser. So with different screen resolutions it displays the same. ...

How to find the remaining time of a setTimeout()

Possible Duplicate: Javascript: find the time left in a setTimeout()? I'm trying to use setTimeout() as a way of pausing a series of events in JS. Here's an example of what I'm doing and what I'd like to do in comments - http://jsfiddle.net/8m5Ww/2/ Any suggestions how I can populate var timeRemaining with the total milliseco...

Control for presenting workflow

Hello, I write an application in asp.net and I have something like state machine which can be modified by user (nodes, paths and directions of paths). Is there any nice controll I can use to display this data ? Just display, there is no need to do anything with it Thanks for help ...