javascript

Explain this fragment of jQuery to me

I am newbie to jQuery, can someone explain what this code does: $(document).ready(function() { var order = null; $("#order-list").load(location.href+" #order-list>*",""); $("#order-list").sortable({ handle : '.handle', update : function (e, ui) { order = $(this).sortable('serialize'); $("...

How do I query the pulled in(embedded) content on an html page?

I have links to pull in xml for a page to use: <link rel="alternate" type="application/rss+xml" title="My document - Google Docs" href="http://spreadsheets.google.com/feeds/cells/tj65zmNwfLSmt-t6clQ-xog/od1/public/basic?min-row=1&amp;amp;min-col=1&amp;amp;max-row=27&amp;amp;max-col=12" /> how do I interact with this document using th...

Ordering of jQuery binding to elements?

Hi, I'm having a bit of a difficulty using jQuery to bind a function to an element. Basically I have a set of divs that I load using JSON. Each of the JSON items have an associated "action" that defines what function to call if that div is clicked. As I iterate through each of the JSON items, I do (editied for clarity): for (var i = 0...

Delphi indy10 http server and ExtJS form submit

I have a problem I don't know how to solve. I have an Indy10 HTTP server. I have used both Indy9 and Indy10 HTTP servers in many applications and never had any problems. But now I am using Indy10 HTTP server with ExtJS javascript RAI framework. The problem is when I submit data that contains non-ansi characters. For instance when I su...

How do I pass a variable from JavaScript (Google Maps API) to my Form Input

Hi, There maybe some simlar questions to this but I can't see anything that really solves my problem. I would like to pass the contents of a variable in JavaScript either into a PHP variable or a html form value. Cheers, knowing how to do both would be very helpful. ...

the Javascript "function pageLoad()" doesn't play nice with UpdatePanel...

So I've got this UpdatePanel. Inside it I have a nifty little jQuery scroll gallery of thumbnails which shows the full image in a container after posting back to get the full image URL from the server. Each thumbnail in the scroll gallery is an imageButton with an onCommand event. What's happening is that when a thumbnail is clicked it ...

What side effects does the keyword 'new' have in JavaScript?

I'm working on a plug-in for jQuery and I'm getting this JSLint error: Problem at line 80 character 45: Do not use 'new' for side effects. (new jQuery.fasterTrim(this, options)); I haven't had much luck finding info on this JSLint error or on any side effects that new might have. I've tried Googling for "Do not use 'new' for side ef...

How do I make this link work in javascript

Ok basically I have this javascript file http://assets.revback.com/scripts/share1.js that basically adds a bunch of share buttons via javascript. What I want to do, is change the twitter image link to use an url shortener: so instead of: <a href=\"http:\/\/twitter.com\/home?status=Interesting Post:(UURRLL)\" title=\"Click to share th...

Detect Click into Iframe using JavaScript

I understand that it is not possible to tell what the user is doing inside an iframe if it is cross domain. What I would like to do is track if the user clicked at all in the iframe. I imagine a scenario where there is an invisible div on top of the iframe and the the div will just then pass the click event to the iframe. Is somethi...

What is the difference between "new Number(...)" and "Number(...)" in JavaScript?

In Javascript, one of the reliable ways to convert a string to a number is the Number constructor: var x = Number('09'); // 9, because it defaults to decimal Inspired by this question, I started wondering what is the difference between the above and: var x =new Number('09'); Number certainly looks better, but it seems like a sligh...

Javascript: How to check if a string is empty?

Possible Duplicate: What is the best way to check for an empty string in JavaScript? I know this is really basic, but I am new to javascript and can't find an answer anywhere. How can I check if a string is empty? ...

problem in passing Id from asp.net to Javascript

Hello, I need to call a functoin on button click and pass the value of id into that function...here is what I m doing ...but I bet i m doing sth wrong bcoz its not working function Datarate(frm) { var ar = document.getElementById('<%= submit.ClientID%>'); alert(ar); } <asp:Button runat="server" ID="submit" Text="Submit" OnCli...

How can I trigger a JavaScript event click

I have a hyperlink in my page. I am trying to automate a number of clicks on the hyperlink for testing purposes. Is there any way you can simulate 50 clicks on the hyperlink using JavaScript? <a href="#" target="_blank" onclick="javascript:Test("Test");">MSDN</a> I'm looking for onClick event trigger from the JavaScript. ...

Returning data from wikipedia using Ajax?

Is there a service or api that allows wikipedia data regarding a string be retrieved only with javascript? ...

Toggle tables upon selection

I have a select element with a few options. Depending on what is selected, I would like to toggle the display for inherited data. <select> <option>Option "A"</option> <option>Option "B"</option> </select> <table> <tr><th>TABLE A SELECT</th></tr> </table> <table> <tr><th>TABLE B SELECT</th></tr> </table> option ...

Testing for numeric input with regular expression

I have the following regular expression: ^[-+]?[\d{0,3},?\d{3}]*\.?\d+$ I am trying to support numbers of the following formats: 1 -1 -1.00 100,000 I am not concerned about scientific notation but my users may or may not enter in commas. The problem I am having is that the expression is matching: 100, 100,00 How can I have t...

How do I get to cousin elements with JQuery?

I have a table with many rows of data, and I want to show or hide some of the details on each row based on a checkbox in the first element. For example: <table> <tr> <td><span class="aspnetweirdness"><input type=checkbox></span></td> <td>Text Text Text</td> <td><select /></td> <td><input type=text></td> </tr> </tabl...

URL getting truncated at 255 characters

I have a JavaScript widget which communicates with my Rails app by creating tags in the DOM. Every once in a while, I see a malformed request in my server logs, where the URL is truncated at 255 characters: http://myapplication.example/mycontroller/1/myaction?hostname=www.mycustomer.example&amp;request[param_a]=3&amp;request[param_b]=1...

Javascript: How to trigger an "onchange" event while the text element still has focus?

As far as I understand, the "onchange" event of a text input element is only fired when two conditions are true: The text has changed. The field no longer has focus. So when you click off, it fires the event. How can I fire an event when the text has changed, but the field still has focus? ...

Validate form with Javascript using onsubmit

I have a website with an existing form, that submits an email address to a thirdparty website (foo.com). Now I'd like to validate the email input-field before submitting the form by using Javascript. My Javascript function isValidEmailAddress(emailAddress) { var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+...