How do I write a Javascript function that accepts a variable number of parameters, and forwards all of those parameters to other anonymous functions?
For example, consider the scenario of a method that fires an event:
function fireStartedEvent(a,b,c,d,e,f,g,...) {
for(var i = 0; i < startedListeners.length; i++) {
started...
Writing a widget to be able to rename files by clicking on the text name and entering the new name. I didn't find any ready-to-use solutions, maybe you can point me to one?
Here is where I ended up and it doesn't work: for some reason, only the last input box is changing, and the first and second aren't referenced:
<span id="text_name...
I've been reading this and I know it doesn't mention possible ways to restrict access to an installed plugin, but is there some trick one can play in order to contain the usage of a plugin?
...
I'd like to know that a user leave from a Web page. I think there might be three scenarios: 1. move to another page in the same Web site, either open a new window or load a new page to the current window, 2. move to a page in different site, and 3. close the window.
Based on these scenarios, what I'm thinking is to check whether the cur...
I was just reading http://stackoverflow.com/questions/1619930/how-to-check-users-leave-a-page earlier on when suddenly I thought of performing AJAX when user leaves the page to send analytical data back to the server.
Is performing AJAX on the onunload event a good or bad practice/implementation?
...
Hi,
Im having issues with having to load my javascript, when I visit my website (php) for the first time(cookies cleared) and I click on a link (which calls a javascript method), it does not work , however if I reload the page and then click on the link, it works(the link does not refresh the page but calls another php page and makes c...
I heard Ryan Bates say that the Rails JavaScript helper methods prevent "unobtrusive JavaScript".
Is this correct and, if so, could someone explain why?
...
I may be asking the impossible, but, how do I surroundContents on a document-fragment node?
My thoughts (which I'd appreciate feedback on), are as follows: Is the solution to close the fragmentation? If that's it, is there some way to detect if the starting node and ending node don't have opening and closing tags?
I'm running into the...
I'm trying to do inline editing for my website using jQuery so I can edit the HTML and text of a page without having to change the source. When I submit the form data though jQuery's $.ajax function, it escapes all the quotes. How can I either prevent jQuery from escaping this(probably a bad idea) or remove them on the PHP side of things...
SOLVED in the last answer
im getting following error, dunno where and why? cause code works fine and i dont know what is wrong, please suggest something :$
uncaught exception: Syntax error, unrecognized expression: #
Line 0
why code and functionality works totally fine, even when this error show.. but it dont work in ie, so i need t...
I've a Web site with hundreds of html pages that are already deployed. Now I want to add event listeners to body such as onload and onunload in all the html pages. I don't want to manually change each of every of them, so I'm thinking whether I could dynamically add these listeners. My idea is to write javascript code that finds the DOM ...
Hi,
I am new to jquery ! I am using the code below to insert record, the data posted to targeted asp page, but nothing happen, but when I try using simple form and post with same coding , the data inserted !
Jquery Code
<script>
$(document).ready(function(){
// code here
$("a").click(function(event){
// alert(...
I'm looking at this Railscast episode and wondering why the call to escape_javascript is needed here:
$("#reviews").append("<%= escape_javascript(render(:partial => @review)) %>");
What is escape_javascript used for?
According to the Rails docs:
escape_javascript(javascript)
Escape carrier returns and single and
double quo...
How to send an http request with either post/get method using javascript as an eventhandler? Thanks! Paul
...
Hi there,
i am looking for some input for how to use linq with javascript, there are number of implementations for javascript around.
anybody use any and which is the most compatible?
I was looking to be able to use linq against JSON and the DOM
Thanks in advance
...
I have a CSS file, which contain the style information of my web.
Some height & width is based on the screen size, so I can calculate the size using
the Javascript, can I embedded the javascript in the CSS file to do so?
...
I have a textarea where people enter some text (naturally), and I want to make it so that an AJAX request is made every now and then to get some suggestions regarding what the textarea is about (like stack overflow's Related Questions, but for a textarea, not a text input). The problem is that I can't do an AJAX request at every keypress...
I am using the jQuery function
function ShowHide(){
$(".login").animate({"height": "toggle"}, { duration: 1000 });
}
and the link to show hide the .login div is:
onclick="ShowHide(); return false;"
But this link only toggles the div to show and hide, but I want it to also hide when the user clicks off the div, I have a page wrapp...
I'd like to convert a money formatted string into a float in javascript.
ex:
'$1,000.20' convert to a float 1000.20
'USD 1,000.20' convert to a float 1000.20
I'm also interested to know how to replace alphabetic characters to say '*'
How can this be implemented?
...
What would be the best format for storing a relatively large amount of data (essentially a big hashmap) for quick retrieval using javascript? It would need to support Unicode as well.
XML, JSON?
...