javascript

jquery - why do i need live() in this situation?

I have a somewhat odd situation. I understand the premise of the live() and bind() functions, yet in a situation where i believe i dont need them, i seemingly do. I will explain. I made an autosuggest in jquery. I included autosuggest.js at the top of my page. I then have an input field. The basis of the JS works around: $(".autosugg...

Facebook Opengraph customize fb login button

Hi I'm using facebook open graph, new api, and i can do this: <fb:login-button show-faces="true" max-rows="9" perms="email" autologoutlink="true" onlogin="window.location = 'http://www.example.com/facebook/facebook_test/'"&gt;&lt;/fb:login-button&gt; but when i read the doc if i need more options in http://developers.facebook.com/do...

Why does jQuery 1.4.2 compressed have a syntax error?

I always have noticed this, including in versions before as well. About half way through jQuery's compressed version you'll see some regex: [^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ The error appears to be at ['"] I'm sure it's not really a syntax error, but all my code editors recognize it as one, which makes development a pain ...

Looking for recipe: Multiple async Ajax requests in JavaScript

I am about to spend a lot of time solving a problem, and I wonder if there is an existing recipe for this. It's a browser-based application (JavaScript and Dojo Toolkit) that is a client of a RESTful Web Service. It uses Comet to automatically update the display. There is a callback function that processes every message received. [Bo...

Shouldn't window.screen.width/height correspond to actual screen width/height?

Toying around with the WebKit browser in the new Kindle 3G, I noticed that window.screen.width and window.screen.height don't reflect the actual screen dimensions. The physical screen (or rather, paper) dimensions are 800 x 600. I get: 800 x 506 in landscape mode 600 x 706 in portrait mode But interestingly, both Chrome and Safari (w...

jQuery to get next match in the DOM after a particular element

I hate to admit it but I'm stuck trying to figure out how to do this. e.g. pretending you have the following structure: <div> ... <div> <ul> <li> <a href="..."><img class="foo"/></a><!-- "previous" --> </li> <li> <a href="..."><img class="bar"/></a> </li> <li> <a href="...">...

Question about executing javascript post-processes in Java app

Traditionally we have always used xml in the response which is parsed by a Javascript method to execute post processes. I came up with a new, simpler implementation which uses a hidden input set by a requestAttribute and executed in an ajax callback. JSP: <% String jsPostProcess = (String)request.getAttribute("jsPostProcess"); ...

Animated gifs to signal that something is computing ? what are better alternatives ?

I have written some javascript whereas if you click on some divs those expand with some data. it takes a few seconds to populate the divs. So to avoid users getting frustrated I have done the following: if user clicks on div then add animated gif (moving bar,...) on div when data is ready event is triggered and animated gif is remov...

Safari is returning the wrong width value

Hi I have a table with a div in it the table has 2 columns and both are 50% In most browsers I can use offsetWidth to get the width of the article. But in Safari the width is less or more than what it should be. Any help would be greatly appriciated. Regards Richard ...

Validate ValidationGroup

Hello. I have a button on which I wish to validate a specific ValidationGroup in ASP.NET. This button is not a server control, but a standard a tag with an onclick event on. I have multiple validation groups on this page, so by calling Page_ClientValidate() is not enough, as the other validators will kick in as well. If your answer r...

How do I create a documentFragment in GWT?

Creating a document fragment using plain Javascript is dead simple: var docFragment = document.createDocumentFragment();. However, in GWT, this does not appear to be available, though there is a DocumentFragment interface in package com.google.gwt.xml.client that does not appear to be applicable. Does anyone know of a way, either using ...

Javascript - multiple complex if statements

Im struggling with multiple complex statements in javaScript and wondered if anyone could point me in the right direction. function findFlights() { var yourDestination = readTheDestination(); var yourAirline = readTheAirline(); var yourFare = readTheFare(); if (yourDestination == 'Choose your destination') ...

Replacing selected HTML text in jQuery

I have this code for replacing selected text: (it putts "1" and "2" before and after selected text): var content=$("#text").html(); if (window.getSelection) { // not IE case var selObj = window.getSelection(); var selRange = selObj.getRangeAt(0); content2 = content.substring(0,selRange.startOffset) + "1" + content.substring(selRan...

Constructively manipulating any value/object within a JSON tree of unknown depth

Hi, I have a JSON tree that contains nodes and children - the format is: jsonObject = { id:nodeid_1, children: [ { id:nodeid_2, children:[] }, { id:nodeid_3, children:[ { id:nodeid_4, children:[] }, { id:nodeid_5, children:[] } } } I don't know the depth of this tre...

How to select a button id when the button in clicked injavascript/jquery

Hello Everyone, I am new to javascript/jquery . I have a small question. I have some thing like the following in the java script file. <button id="button1" onclick=click() /> <button id="button2" onclick=click() /> <button id="button3" onclick=click() /> so the click function looks like the follwoing click(id){ /do some thing } s...

DynamicObject and Jint

I want to use DynamicObject class under Jint and I have built a sample to do it. First assert is correctly passes but fails at second assert. Is there any way to do it or do you know any other javascript engine that makes it possible ? public void Jtest() { Jint.JintEngine engine = new JintEngine(); dynamic subject = new MyDyn...

How do I print text into a form from an <a> link?

I need to be able to print text into a form field from an <'a'> link. Basically I have a list of job postings on one page, and an 'apply' link for each one. What then will happen is it'll bring up a form with the "Job Chosen" field already filled out with the "Job Title" from the previous page. Something like <a href="applyform.php?su...

jQuery UI widgets

What jQuery UI widgets are there, except from the official ones? I know Accordion Autocomplete Button Datepicker Dialog Progressbar Slider Tabs ...

How do i ensure that my textarea value should always contain the word "india" in javascript?

Hi friends, How do i ensure that my textarea value should always contain the word "india" in javascript? Actually i want to validate the textarea so that the user should always the word "india" in that. Please help me. Thanks in advance. ...

How to show text/info in certain place on textover using javascript

http://www.baelkopat.com/GECCo/goingGreenTest.html what I have so far.What I need to learn is to show the additional text when user mouseOver the link. i.e. when user mouseOver on "Activity Guide(PDF)" the "Download and print...." shows up... I have pretty good experience with actionscrip not that very new to javascript... I was wonde wh...