javascript

how to handle the event when markers load into memory .

i have many makers (maybe 500) to insert to maps, so i want to Optimization them google.maps.event.addListener(marker, 'visible_changed', function() { alert('ww') }); this code can't alert 'ww', when i zoom in the map(so some marker will not be seen) why can't trigger the 'visible_changed' event when zoo...

YUI Dom.getChildren

Can you change classes without id when your classes are dynamic and only the parent has an id? I have something like: <div id="number_block"> <div class="one science easy left"></div> <div class="one science easy center"></div> <div class="one science easy right"></div> </div> I only reach this part var number_block_children =...

Help me optimize this jQuery :has selector

I'm using dynaTrace to profile my application in Internet Explorer. One of the most expensive calls is the following: $("div.containerClass:has(div.containerHeader)") I scoped the selector as follows, which offered a little improvement: $("div.containerClass:has(div.containerHeader)", "#section-wrapper") How can I improve the perf...

JQuery UI Toggle

I am trying to get JQuery to give me the following setup. One listbox contains three options. One of these options, when clicked, will reveal a div. Either of the other two options reveal a second div. I am using JQuery UI/Toggle: http://jqueryui.com/demos/toggle/. For example: <%= javascript_include_tag "ui/jquery.effects.core.js", "ui...

Why do I only get first element in Javascript array passed from Silverlight?

I'm attempting to pass out an array of strings from a Silverlight application to a Javascript function. However I only seem to get the first element of the array, rather than the whole array. I've reproduced it with the simple code below: Silverlight: string[] Names = new string[5]; Names[0] = "Test1"; Names[1] = "Test2"; Names[2...

How to find client computer name in java script/jsp?

Hi, My print application has to get the client name and then print the documents. How to find this in java script or jsp? I searched here. Some are discussing on PHP and so? Something discussed about running secure applet to get the client computer name? If so please give me example to do that? Thanks to all ...

Textarea : elem.val() vs elem.text()

This is very weird. Apparently, I can use both .val() and .text() to manipulate textarea text. But after I use .val to change the text, I cannot use .text anymore. The converse is not true. This is leading to some funky bugs. The reason is because a plugin i am using might be using .val to manipulate the text. Can anyone explain how ...

Replacing selected text in the textarea

Hi folks, what is the best way to do this in jQuery? This should be a fairly common use case. User selects text in a textarea He clicks on a link The text in the link replaces the selected text in the textarea Any code will be much appreciated - I am having some issues with part 3. ...

Is there any way to load json from a subdomain?

I'd love to stash some .json files on a CDN a la static.mydomain.com. Truth be told, static.mydomain.com is a CNAME in front of an Amazon S3 bucket. I understand this violates the JavaScript security model. Is there an advised workaround or design? I've seen server-side stuff suggested like a PHP script to suck down data via cURL or fil...

Jquery/Javascript: what does the " i " in " (function(i){ " do/mean? How does it know that?

In the example below, the Jquery code changes the src of the images on the page to start with "test", and end with ".jpg", but what tells it what i is? if i'm correct, i could also be number, or e, or z, or n, or whatever word or letter i want, so, by placing that i in there, is it saying that i is the current object? or the name of the ...

Can't seem to add checked attribute to checkbox via jQuery?

Edit I just tried adding this.setAttribute('checked', 'checked'); and it seems to work. Of course just minutes after I make this post....Anyone have any ideas why jQuery's attr() method didn't work? I can't seem to add a checked attribute to a checkbox via javascript. What I'm trying to do is retain state (via localStorage) of some for...

Is there any way to shorten url by goo.gl by javascript

I want to add a button at my webpage, when I click the button it will try to locate goo.gl and input the current url. How could I use goo.gl service by javascript? FYI: I found somthing at here http://www.labnol.org/internet/create-google-short-url/11748/ but how to import this function? var auth_token = getUrlShorteningRequestParams(...

jquery theme builder CSS question

How do I change the size of an icon from the JQuery theme builder? The icon is too small to use. Setting height and width is wrong... ...

What is difference between $(".anything").click() and $(".anything").bind(click)

What is difference between $(".anything").click() and $(".anything").bind(click) $(".anything").click(function() { }); $(".anything").bind('click', function() { }); ...

How do I replace an inline JavaScript event handler?

I'd like to use JavaScript only (no jQuery) to replace an inline onmenuclick event handler generated by a third party control with my own. The custom control has added the following HTML to the page: <ie:menuitem menugroupid="200" description="Create a site for a team or project." text="New Site" onmenuclick="if (LaunchCreateHa...

(Node.js) application that lets me edit a local file through a web browser?

I wonder if there is a Node.js application that starts a server on the current folder to let me edit files through the web browser? Kinda like http://www.cloud9ide.com, but for general editing (scripts, text etc). ...

Node.js: Connecting to a Server Using Sockets

I'm just starting to play with Node.js today, and thought I'd start with what I thought would be a simple script: Connecting to a server via sockets, and sending a bit of data, and receiving it back. I'm creating a command line utility. Nothing in the browser. An example of a server would be memcached, beanstalkd, etc. It seems the net ...

jquery animate removes scroll in div for IE

Right now I'm getting this strange problem where when I use jQuery's animate() function on a <div> it removes the ability to scroll. I'm adjusting the height with animate(). This problem only comes up with IE and works fine with Chrome and FF. Below is my css class for my div div.fullscroll{ height: 65%; width: 75%; overflow-x:...

for loop inside jquery function

I am trying to repeat something inside a jquery function. I tried a for loop, but it seems it doesnt like the syntax. for instance i have the variable var number = 2; now i have $('tr').html('<td id="'+number+'"></td>'); what i want to do is loop from 0 to number (0,1,2) so that in the end i end up having 3 . Thanks ...

Force AutoCompleteExtender dropdown to redisplay via Javascript

I have an AjaxControlToolkit.AutoCompleteExtender control attached to a textbox, and three radio buttons. When the user selects a radio button, the service method used to retrieve the values listed in the AutoCompleteExtender is changed, as follows: $("#radioButtonList input").click(function() { var selectedValue = $(this).val(); ...