javascript

best way to detect handheld device in jQuery

Is there a solid way to detect whether or not a user is using a mobile/handheld device in jQuery? Something similar to the css media attribute? I would like to run a different script if the browser is on a handheld device. The jQuery $.browser function is not what I am looking for. ...

Cufon rendering line breaks

Hi, I have been using cufon for the last year and a half and have never seen this... Say I have: <h2 class="my_font">This is some text</h2> <p class="my_font">This is some more text</p> The text is rendered properly but the line break gets rendered as a new line, for example: <h2 class="my_font"><cufon class="cufon cufon-canva...

How do I pass Javascript variable to <jsp:setProperty> and JSTL?

How do I pass Javascript variable to and JSTL? <script> var name = "john"; <jsp:setProperty name="emp" property="firstName" value=" "/> // How do I set javascript variable(name) value here ? <c:set var="firstName" value=""/> // How do I set javascript variable (name) value here ? </script> ...

Google Analytics - Event tracking in new window with JavaScript error?

I am currently attempting to track outbound links with Google Analytics and seemingly having some issues. I modified the provided GA code to open in an external window but it seems that a good portion of clicks are not being tracked. My question is does it seem like there could be reason why this code could not work or is there an alte...

How to apply multiple events to the same function

I'm not the best at this jquery stuff. But I'm trying to seperate the action from the function so I can apply multiple events that cause the same function. Unfortunately this isn't working. Anyone know why? Updated Function, but still errors $(document).ready(function() { var $info_items = jQuery('.checkbox.has_info, .has_info'); $in...

Prototype JS source what does this mean? Array.from = $A... Hash.from = $H;

Just wondering what are the side effects or what does this mean or do. I noticed it in two parts of the source code for the Prototype JS library. Hash.from = $H; Array.from = $A; any clarification would be greatly appreciated, and Thank you in advance. ...

Why does Eclipse hang on copy/paste in Javascript files?

I've been running Eclipse Helios 3.6 using the Java/CFEclipse IDEs, and finding some very strange and aggravating errors when trying to edit Javascript files. After the .js file reaches a certain size (~250 lines of code), Eclipse will randomly hang whenever I try to select, copy-paste selections, or save. Clicking after the hang starts ...

check text area for certain character combinations

I have a text area which gets filled in various ways including paste, keyboard input, from an autocomplete etc. Now I want to validate this text area and if contains any combination, including multiples of some characters and if so, set it to empty. The characters I want to filter are: tabs, new lines, spaces, carriage returns, as wel...

Javascript: How to generate formatted easy-to-read JSON straight from an object?

Hi all. I know how to generate JSON from an object using JSON.stringify, or in my case the handy jquery-json from google code (http://code.google.com/p/jquery-json/). Now this works fine, but the output is hard to read for humans. Is there an easy way / function / whatever to output a neatly formatted json file? This is what I mean...

How can I handle a list with several hundred items in HTML? (Using Javascript)

I am creating a web page which is designed for mobile safari, and I create a list dynamically. The list is created from a text file in which I receive information and I append this information to the list. It works fine when there are about 200 items, but when the file is very large, (I have tried with up to 4000 items) the page becomes ...

CSS/Javascript <ul> Menu Pop Up

I'm trying to create a simple menu pop-up effect using anchors within a div and unordered lists. I want the html to look something like this: <div class="info"> <a href="#">Link</a> | <a onclick="menu('id1');">Another Link</a> <ul id="id1" class="submenu"> <li><a href="dfhdfh">Stuff</a></li> <li><a href="aetjetjsd">Other</a></l...

Event not firing within a function when using jqGrid and jQuery

I'm new to javascript, jQuery and jqGrid, so this is probably a pretty basic question. Why does the event fire correctly here, triggering the alert: $("#list").jqGrid({loadComplete: alert('load complete') }); but not here when the alert is inside a function? $("#list").jqGrid({loadComplete: ...

Can you define DOM Helper?

I ran across the word DOM helper. I know what DOM stands for, but how would one really define the term DOM Helper? ...

Assigning ID's to a dojo Tree Node

Hi Guys, I have a Dojo tree implemented. However, I am trying to add id's to each node of the tree to use it somewhere else. I tried dojo.query(".dijitTreeLabel"), but It has a very strange behaviour. Sometimes it dosent return the children elements and just the parent. Sometimes however it works perfectly. So, I am looking for a sta...

ASP.NET __doPostBack rendered after beginning or near end of form tag

I'm trying to manually call the ASP.NET (3.5) javascript postback function __doPostBack from my javascript code. The problem is that the postback script block, that is normally rendered right after the beginning of the <form> tag (and the hidden fields), is occasionally rendered near the closing </form> tag. Is there any way to force i...

JSON object value based on other object value

I need to find a value based on another object value json = {[{ID:"1",city:"Atlanta"},{ID:"2",city:"New York"}]} and so forth. I need to find the value of a city where ID is x. Is there anyway to do it without using loops? More Details: I have to create a json object looping thru the document, then I send this json to the webservice...

Is there a way to let a user view an image they are about to upload client side before uploading to the server?

When a user is uploading an image, is there a way I can load the image client side and show it to them first, before uploading it to the server? Preferably using javascript/jquery only, but using flash would be acceptable too. ...

Stream Twitter by search hashtag and then offical twitter stream

How do I go about calling the twitter API in a way similar to http://socialmedia.duke.edu/#stayconnected We are looking to do the same type of thing. I cannot figure out what is calling to twitter though in the code. Any help would be greatly appreciated. I can supply any needed details that you would need. I am using Wordpress but ju...

Can't get jQuery Cycle to work in Amazon Webstore

I'm running around in circles trying to figure out why I can't get jQuery Cycle to work in our Amazon store. jQuery seems to be working fine, as I can run commands from the console, but any time I try to call .cycle(), i get a "*.cycle() is not a function" error. I've used cycle on several other websites with no problems, but this has co...

Full-word selection in browser.

I understand that IE has a full-word selection feature, which people often want to turn off. I want the opposite. I want to automatically expand the selection to complete words in all browsers. Actually, for the moment, I don't really care about IE (but I will eventually). Anyone know of a solution for this? Thanks. ...