javascript-events

javascript removeChild(this) from input[type="submit"] onclick breaks future use of form.submit() under firefox

I have come across some strange behaviour, and I'm assuming a bug in firefox, when removing a input submit element from the DOM from within the click event. The following code reproduces the issue: <form name="test_form"> <input type="submit" value="remove me" onclick="this.parentNode.removeChild(this);" /> <input type="submit" value="...

window.unbeforeunload show div IE7 problem

Currently I am developing a web application for which I am using a preloader icon. What I want is that the preloader becomes visible every time the user navigates to another page or refreshes the page. So far I have the following solution: window.onbeforeunload = function() { $("applicationdisabler").show(); }; For Safari and Firefox ...

JQuery delegate method not working

I am trying to use the delegate method on a grid that I wrap with the DataTables.Net plug-in. I originally had this code which works as expected. $("#myGrid tbody tr").click(function() { var id = $(this).children('td').eq(0).text(); alert(id); }); However, if I change the paging size then the newer rows don't h...

Call function on div click

Hello I am doing this: <div onclick='alert("xxx")'>Click me!</div> and i see that alert but i want to call on function inside that onclick. I'm trying this but it doesn't work. function GetContent(prm){ alert(prm); } <div onclick='GetContent("xxx")'>Click me!</div> I need to call that function inline not assign an id or cla...

How to detect a click or mouse press on IE with Raphael and jQuery

I'm trying to find a way to trigger an event when a mouse clicks on some text generated from Raphael JS. In Firefox, the click event works perfectly, in IE 7 and 8 (I haven't tested earlier versions) neither click nor mousedown work. Click works fine for other raphael objects, e.g. the rectangle in the example. How can I trigger an eve...

How to make $(document).ready() functions available globally?

Hello everyone, I have an interesting question here that may sound pretty silly, but here goes. Using JQuery's ready function I have defined some functions like so: $(function(){ var function1 = function(data){ //do something } var function2 = function(data){ //do something else } }); For some reason, in order for ...

How do I create a random method name

I plan on using JSONP to call an external webservice to get around the fact that I dont want to create a global function that could potentially conflict with the calling page. I thought that creating a random function name and passing it up would work. Something like this: <script src="www.foo.com/b?cb=d357534"> where cb is the callb...

Old fashioned html onclick return false doesn't work inIE when jQuery script is included

Ok, so I'm quite new to jQuery, but found this bizzare problem just now, If we ignore jquery for a second and consider this scenario, if i have two links like below both with an href and both with and onclick event. The first link will not follow the href because the onclick returns false, and the second link will because the onclick r...

How can I detect which control initiated a blur event using javascript/jquery?

I have a radiobuttonlist; when item[1] is clicked a textbox is displayed and my custom JQuery validator is bound to the textbox onblur event. Here's a pared down version of my validator.. function AddMyValidator() { $("input[id$='myTxt']").blur(function(e) { var val = this.value.replace(" ", ""); if (val.length == 0)...

stopping backspace on multiple browsers using jQuery

I am attempting to stop a backspace keydown event from being handled by browsers, I'm using the jquery library, so I need to get the original event, but on some browsers (firefox at least) I get an error when trying to set the original events keyCode = 0, it gives and error saying that only a getter exists for that property. function bl...

how to get a word under cursor using JavaScript.

in this case: <p> some long text </p> how can i know that mouse cursor is above the 'text' word? ...

how to handle signout when the browser in close in flex 3?

my project had audit module ,which inlcude each and every action of the user to be recoreded so when the user closes the browser the audit regarding the logout has to be stored in the database i found one solution in the net ,but it is working in my machine's IE but falied to work in the friends machines IE why? the code is: window....

Doing some stuff right before the user exits the page

I have seen some questions here regarding what I want to achieve and have based what I have so far on those answer. But there is a slight misbehavior that is still irritating me. What I have is sort of a recovery feature. Whenever you are typing text, the client sends a sync request to the server every 45 seconds. It does 2 things. Firs...

How to access and run field events from extension js?

I have an extension that helps in submitting forms automatically for a process at work. We are running into a problem with dual select boxes where one option is selected and then that selection changes another field's options. Since setting an option selected property to true doesn't trigger the field's onchange event I am trying to do s...

What's the easiest way to do form validation for jQuery?

All i want to do is to check if the textfield has been changed. if not, i want to highlight the boxes when submit is pressed. how do i do that? seems very simple, but not sure why every other solution is so complicated ...

Divs over images using JavaScript

Say I have an image with a couple of dots in a web page. When someone clicks on the dots I want a JavaScript function to be executed and then a div placed over the clicked dot in the image. Something akin to markers in maps. How do I go about doing this? ...

Why wont this JS code work if its all on the same line?

I'm writing HTML code for a java servlet. i first write the code in html/js so i can debug what im working on, and then ill make it a java string and put it in my servlet. My problem is that the code is working fine when i view it in ff from a local html file, but when i view it on my java servlet, it doesnt work because the js isnt ge...

Google Maps v3, custom control with textbox: can't perform input

Hi, I am trying to add a custom control to my google map (v3): want to have search box just near the other map controls. So I add a div with <input type="textbox"> on it, and it's being shown on the map. But the porblem is that the textbox is inaccessible: i can't type anything inside it, or even focus on it. function SearchBox() { ...

What is the difference between Window.load and document.readyState

Hi All, I have one question , In my ASP.NET MVC web application i have to do certain validation once page and all controls got loaded. In javascript i was using belwow line of code for calling a method. window.load = JavascriptFunctionName ; Some one from my team asked me not used above line of code Instead use JQuery to do the ...

Alternative to jQuery's .toggle() method that supports eventData?

The jQuery documentation for the .toggle() method states: The .toggle() method is provided for convenience. It is relatively straightforward to implement the same behavior by hand, and this can be necessary if the assumptions built into .toggle() prove limiting. The assumptions built into .toggle have proven limiting for my curren...