javascript

Difference between console.log and sys.puts in node.js?

In node.js you can use console.log or sys.puts to print out to the screen. What is the preferred method and what is the difference between these? ...

jquery problem please help

hi, i am using jquery using div means when i select from one select box then data have been populated into the next select option but there is on big problem ie. when i hit the submit button from JSP page the action have called abc.do, and response back on the same JSP page, but this time the select option do not have a value. it flushes...

want to change color at multiple places in one go !

Hi, My problem is I have couple of divs in my page. All have header of similar color. Now if I have to change the color(for example background color) of all divs, I have to make changes as many divs I have. Is it not possible to just change or say write the color code at one place (like in a variable) and the then use that variable as c...

Jquery Custom Validate Plugin AddMethod on Dynamic Forms

Hi All, I am trying to use the Jquery Validate Plugin and I was able to figure out how to use it on static fields. My problem is on how to used it on my dynamic forms. I created a fiddle to discuss my problem. Hope you can have patience on reading this. The fiddle link is here Now, here's what I want to do, validate the Machine ID...

Jquery - If cursor position at the start/end in a textfield

Hi, i have a textarea and I want to check if the cursor is at the start or at the end (I dont need the current position). Did anybody know a simple jQuery solution? Thanks in advance! Peter ...

Is there any public API to access the current timestamp using javascript?

I have a Chrome extension that relies heavily on a server back end to function. In a few weeks I'm going to need to do some changes on the server for about an hour. Is there any public API that can be used to get the time from a server (probably someone who's made one on appspot or something), all I need is to have everyone getting the s...

Inserting value to AjaxControlToolkit.HTMLEditor using javascript

I'm using AjaxControlToolkit.HTMLEditor, and I want to add value to it using javascript or jquery like this: alert( $find("eCompose_ctl02_ctl01")); // if $find("eCompose_ctl02_ctl01").attr('value') = "asdfasdfasdf asdfasd asdf sf"; also tried like this: document.getElementById('eCompose_ctl02_ctl01').value += "ababsakas asdasd l"...

jquery div fadeout on child form event

Hi. I'm new in jquery/javascript and couldn't google for any solution. I have number of divs generated automatically from cycle. Each of them contains form as a child element. So on form submit I'd like the corresponding parent div to fadeout. I am using Ajax for form submission. Basically, now I have an event handler 'submit' binded...

Javascript comments for ajax calls

At the moment I use phpDoc style comments when documenting javascript functions, mainly because I am used to the syntax and I feel that phpDoc is a good, comprehensive commenting style to adopt. One thing it doesn't cover though is Ajax requests (obviously) and I was wondering if there was a set standard for commenting these? Or if any...

Is there a name for this pattern?

I am basically quite sure this pattern must exist and possess a name... for now I will call it "gate pattern"... Here it is: In my webpage's javascript, I have to trigger various asynchronous processes. Let's not discuss how trully async js is, but anyway I have to trigger 2 or 3 AJAX calls, must be sure, the UI build-up has finished, ...

How to execute a YUI function from Javascript?

How can i call a YUI function that is wrapped inside a YUI().use from javascript? example Below is a YUI function "runShowAnim" which executes animShow.run(); for an animation effect... var runShowAnim = function(e) { animShow.run(); }; I want this effect to happen when i validate something in a javascript function. I tried to...

JavaScript function that can produce same results as PHP function number_format

I'm in search of a JavaScript function that can produce the same results as the PHP function number_format(150000,0,',',','); is there a JavaScript function available to do this? ...

Preffered calender for ASP.NET

Hey, I search a good calender for my business application. The Microsoft ASP.NET calender is perfect for my requirement, but I heard that this component is not longer supported by Microsoft. My apprehension is that I must in the near future program a new one. Should I use a jQuery calender ? Can I use a future-proof library ? Thank you ...

How to select next 2 (or more than 2) items using jQuery .next()?

using jQuery's .next function I want to show next 2 items. By default it selects only just next item. I need control, like sometimes I need next 2, sometime next 3 ...

looking for a more comprehensive Javascript onload event

I am developing a script to avoid Flashes Of Un-styled Content by hiding the body element until its contents have fully loaded. This is designed as a plugin for pages rich in disparate and often weighty resources that gradually populate the page, make DOM manipulations etc, leaving the user with a page that is displayed before it is fin...

How to begin with autocomplete(jQuery)

Hi all, I need some help in getting started with jQuery and autocompleting a username for example. $('#username').replaceWith('<input id=\"username\" type=\"text\" name=\"user_name\">'); My first aim was to replace #username(dropdownbox) with a textfield. I already figured that out. My second aim is: Username: Faili Username: Feli...

file upload using ajax

I am looking for a ajax method that can be used to file upload. It will be super if I find a funtion that uses Prototype + Script.acul.us ...

Inserting value to AjaxControlToolkit.HTMLEditor using javascript

I'm using AjaxControlToolkit.HTMLEditor, and I want to add value to it using javascript or jquery like this: alert( $find("eCompose_ctl02_ctl01")); // if $find("eCompose_ctl02_ctl01").attr('value') = "asdfasdfasdf asdfasd asdf sf"; also tried like this: document.getElementById('eCompose_ctl02_ctl01').value += "ababsakas asdasd l"...

How to retrieve the constructor's name in JavaScript?

Assume the following program: var C = function() { }; x = new C(); The expression x instanceof C yields True, so x has to know somehow that it was constructed by the function C. Is there way to retrieve the name C directly from x? (In my problem at hand, I have a hierarchy of prototypes implementing possible signals in my application...

Use javascript to get raw html code

I need to get the actual html code of an element in a web page. For example if the actual html code inside the element is "How to&nbsp;fix" Running this javascript getElementById('myE').innerHtml gives me "How to fix" which is the decoded form How can I get "How to&nbsp;fix" using javascript? ...