This jQuery 1.3.2 code adds an element to the page, registers a "click" event, then removes and reattaches the element:
var button = $('<button>Click me!</button>')
.click(function(){ alert("Hello") })
.appendTo('body');
$('body').html('');
button.appendTo('body');
The button appears on the page as expected, but clicking on it ...
I can't fire personal events using Javascript in IE. In Firefox work great.
My code is:
var evento;
if(document.createEventObject)
{
evento = document.createEventObject();
document.fireEvent('eventoPersonal', evento);
}
//FF
else
{
evento = document.createEvent('Events');
evento.initEvent('eventoPer...
Hello,
I'm a relative tyro in the Javascript programming arena, so please go easy on me. :-)
I am trying to add an eventListener to various DOM elements on a page. However, some of the elements I'm adding my event to already have an eventListener, and I don't want to supersede that one; I only want to add my event to an element that ...
I believe something on this code chunk is not properly coded making it incompatible on XHTML 1.0 Transitional.
The code snippet collapses div and then on click they will expand.
Can somebody see what could be wrong?
<script type="text/javascript">
function toggle(div){
el = document.getElementById(div);
if (el.style.display == 'n...
I would like to have an input that would change to upper case on keyup. So I attach a simple event on keyup.
HTML
<input id="test"/>
Javascript (with jQuery)
$("#test").keyup(function(){
this.value = this.value.toUpperCase();
});
But I found that in Chrome and IE, when you push left arrow, the cursor automatically move to end. ...
I don't know a thing about implementing extensions in Firefox, but having not seen an extension that does anything like this in the Mozilla's addons page, I don't believe it is possible, but thought I will ask about it anway.
...
I have a form for which onkeyup triggers the creation of a suggestions box for certain fields. I am able to capture the keystrokes for the up arrow, for the down arrow and for escape and use them accordingly to move around in the suggestions box or close it. I would like to use enter to move their selection into the input field that tr...
Hi I have Drag/Drop functionality in my page embedded using YAHOO.js which is initalized at load of the page. When 'alert' is put in the init function, the Drag/Drop is working otherwise
it is not.Using Firebug I had debugged the code and seen when init function is called but not looping through the function when no alert is put.
This fu...
Hello!
Is there a way to open a select box using Javascript (and jQuery)?
<select style="width:150px;">
<option value="1">1</option>
<option value="2">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc arcu nunc, rhoncus ac dignissim at, rhoncus ac tellus.</option>
<option value="3">3</option>
</select>
I have t...
Imagine you have a button like this:
<input name="myButton" type="button" value="button" onclick="return test();" >
where the test functions is as follows:
function test(){
// do something
return true; // based on some logic return boolean
}
Now let's say,I don't know what is set for the onclick event, and at runtime I need to ...
I am working on a site that has loads of legacy javascript and jquery includes and there is no documentation to show what is happening when.
I have a specific problem to fix and I cannot find the relevant code that is being executed when a button is clicked. To save me from trawling through (and making sense of) hundreds of lines of leg...
How do I create a custom event class similar to ActionScript? What I mean by that is a class that I can use to fire off my own events, send the necessary data.
I don't wanna use third-party libraries like YUI or jQuery to do it. My goal is to be able to send a event that looks like this.
document.addEventListener("customEvent", eventHa...
I was wondering if its possible to use Javascript to change the function/method that an HTML element calls.
Example:
<input type="button" id="some_id" name="some_name" value="A Button" onclick="someFunction()" />
I now want to use Javascript to change the method/function called on the onclick event to another function has displayed ...
I need it to use in my firefox extension.
I already tried window.onload event listener, and check if current url == old url, and it's a good idea, but it does'nt work when page loads pdf.
I saw hash changed function too but it works only with ff 3.6; i need it to work at least with ff 3.
So, i need an event listener that check if docum...
I am looking for the best way to speed up the load time of my js.
The problem is that I am working with a very large site that uses the jquery framework, and what's happening is because the site is also loading, facebook connect, addthis sharing, google analytics and another tracking code, the jquery is delayed a few seconds, and certai...
I have binded jQuery hover to many elements on my page, and when I move mouse rapidly, hove will not catch all events that should be fired. Is there any workaround for this "feature"?
...
Im doing my own ajax thing with dropdowns. Ive positioned an imput over a select tag. When stuff is typed into input it collects from db and populates the select menu. Problem is its not noticeable. Is there a way to make the select menu open as if a user has clicked on it?
...
Hi,
I am doing a project for school and I'm really struggling to understand how to create the code/commands for my for loop in Javascript. Any help would be greatly appreciated.
The project is basically this:
-There are two arrays: one set of 10 French words another with a set of 10 Engish words. They look like this:
var english=new A...
Hi all, it maybe sleep deprivation but I cannot understand why this isn't working. I want the onclick to return the value of i from a for loop that created the element and applied the event handler. Have put it in a closure and it is still turning the max number of the iterator.
window.onload = function(){
var arbitrary_amount = 100;
...
I have a radio button, containing an inline onclick event:
<input type="radio" class="quantitycheckbox" onclick="alterQuantity(this.form)">
I'm trying to unobtrusively add some more functionality on click, and have this code:
function updateCustomFields( box ) {
// save current onclick event before assigning new one
var currE...