Tagged Questions
-1
votes
2answers
32 views
How to create an href that opens a div on screen?
I have a page with a link, that I want that everytime a user clicks on it – it opens a div with content on it - and clicking anywhere will close it.
How do I do this using CSS ?
Or should I do this ...
0
votes
2answers
25 views
using `new` and `()` with require
What is the difference between
var events = require('events'),
emitter = new events.EventEmitter();
and
var emitter = require('events').EventEmitter;
or EventEmitter is pretty forgiving in ...
0
votes
1answer
16 views
In JavaScript onClick: why stroke appears then disappears?
Guys I am using this code but the stroke appears and directly disappears when I click:
var tag = document.getElementById("tag");
function result()
{
$(tag.value).css('border','1px solid red');
}
...
0
votes
0answers
15 views
one object doesn't listen to an event emitted on another object
Trying to make an object emitting and receiving events:
var events = require('events'),
util = require('util');
function Obj(){
events.EventEmitter.call( this ); // what does this line?
}
...
0
votes
0answers
8 views
Fullcalendar.js get events of the day on click
Fullcalendar.js get events of the day on click
Is it possible to get all events of the day I click on in the monthview and print them in any div element with Fullcalendar.js?
Here's my JSFiddle:
...
1
vote
3answers
36 views
Fire event only when clicking on an element, and not on its children
If i bind a click handler to the body element, when i click anything on the page the event is triggered. I can check the event.target on every click:
$("body").on("click", function(event) {
if ...
2
votes
0answers
27 views
Window.onpopstate it's activated with all href links
I'm implementing a pagination using jquery ajax but manipulating the history of the browser.. and works fine so far but I realized a few hours ago that if I have a link in any part of my page
<a ...
0
votes
3answers
21 views
addEventListener firing multiple times for the same handle when passing in arguments with anonymous function
For some reason, the event listener is firing twice for each element when passing arguments into an anonymous function. I.e., the click event on element el will register once and, thus, fire once.
...
1
vote
1answer
21 views
window.load not working if the page has redirect
I have got a strange problem.
I am using window.open() to open a new window, and $(window).load() to check if the new window has been loaded or not.
The problem is, if the new window has a redirect, ...
0
votes
1answer
47 views
React custom event listener
I'm writing a Chrome extension that places a button next to the "reply" button of each email. And elsewhere on the page is the main React component. When the component loads, i add listeners to a ...
-12
votes
0answers
49 views
How to debug a jQuery complex plugin? [on hold]
It works quite different from general plugins, I'm writting it for fun and for myself; I won't explain much in here what it is about, these are the docs:
...
0
votes
0answers
4 views
window.##EventListener not working when returned from a function
I did in fact look for this in the search bar so don't even try to mark this one as "already answered."
So in my code I have multiple functions that use window.add(remove)EventListener(...). I found ...
-1
votes
1answer
15 views
JavaScript embed video that will change everyday.
I'm really a newbie in JavaScript so that I don't know how would I embed a video that will change every day. Example video 1 is for Monday and video 2 is for Tuesday something like that. I'd created ...
0
votes
1answer
62 views
JavaScript css styling not working in IE
JavaScript css styling not working in IE, It is working in Chrome and Mozilla.
This is my code:
document.ready=function() {
var val = document.getElementById("registration_select").value;
...
1
vote
1answer
60 views
Remove custom event listener
I'm listening to a custom event:
evt = new CustomEvent("fileThisEmail", {
detail: {
name: name,
email: email,
content: content
}
});
window.dispatchEvent(evt);
...
0
votes
0answers
49 views
Best way to handle JS events for components nested in components?
For example, a tabs component within a tabs component. I'm currently working on the next major version of Titon Toolkit (https://github.com/titon/toolkit), 2.0, and I want to support this scenario as ...
3
votes
3answers
27 views
JQuery losing initial click event when reloading a table via .load() after a .change() handler
I am working with a complex application where there are two divs each of which contain the HTML/JS of a separate page. Each div is loaded in a $(document).ready() script. The top div contains a ...
-1
votes
1answer
26 views
Javascript event addEventListener registering multiple times for same function; using OOP Javascript
I'm employing Object-Oriented Javascript, in conjunction with registering event listeners. From what I understand about event listeners, if the function applied to eventtarget has already been ...
1
vote
1answer
23 views
Is javascript event handlers removed from browser memory after removing them? [duplicate]
If I've added an event handler...
$('button#test').click(function(){
// some actions
});
<button id="test">click me</button>
..and then I remove this button element, ...
0
votes
1answer
39 views
Javascript trigger custom method on execution of any object method
I have an object with some added methods to its prototype:
var MyClass = function() {
this.name = '';
this.innerData = [];
this._callbacks = {};
};
MyClass.prototype.add = function(data) ...
0
votes
0answers
27 views
load audio file per each page in a E-book with a single play button in navigation bar
How could I load audio file when I click play button if I have audio files per each page?
My html mark up is some thing like this
<div id="container">
<div id="main">
...
0
votes
3answers
34 views
javascript method is undefined
I'm trying to learn javascript. As part of that effort, I am writing a basic minimax AI. I have the following methods:
Computer.prototype.expand = function(node) {
/* adds all state action pairs to ...
0
votes
0answers
17 views
JavaScript OnExecute Functionality in IE10 browser
How to invoke OnExecute() function in IE10 browser. When I try to run the below command (in console via F12 Dev tools) it showing like this in IE10
>> OnExecute();
"'OnExecute' is undefined"
...
0
votes
0answers
30 views
binding dynamically generated jquery mobile elements to javascript events
so i have multiple pages in my jquery mobile app and the "infamous" back button is being inserted dynamically..what i mean is that when the main page loads the back button does not show up on the ...
-3
votes
1answer
37 views
Javascript Function
Can anyone help me on how does the below javascript function will work.
Onexecute(ctrl);
This function will be invoked after clicking on the button.
is there any differences in functionality of ...
0
votes
1answer
17 views
In Object-Oriented Javascript pass object member method to event handler
In Javascript I have defined an object like this:
function myObject() {
this.x = 5;
window.addEventListener("resize", this.resizeHandler);
}
myObject.prototype.doSomething = function() {
...
0
votes
1answer
26 views
Websocket when closing window/tab - Chrome
I just want to confirm that any websocket(s) open on a page & connected to the server with close right away (or eventually?) when a user closed the tab. Since the console for the page is gone when ...
2
votes
3answers
35 views
How to handle the same jQuery event handler on multiple elements?
Suppose you have the following code to update many elements:
<div class='item'>
Name:<input type='text' name='name' data-id='123' value='Name 1'>
<button ...
-1
votes
0answers
26 views
How to add event listener to DOMContentLoaded after location.reload()?
function foo(){
console.log("FOO");
}
...
location.reload();
document.addEventListener("DOMContentLoaded",foo);
I tried it on Firebug console. Apparently this doesn't work, more specifically, ...
0
votes
0answers
50 views
Editable Div not firing “KeyUp” event/ Removing Highliting
i using editable div,
<div class="editableDiv" contenteditable="true">
sdtgssdrsdrtyy ╚asasasarrstssdertrtyrtyrrty ☻aaaaaaaaaaaaaaaaadaafsdsf4n
</div>
I am having task to show ...
-1
votes
0answers
29 views
how to understand javascript style pattern… how auto form filler work
javascript:function%20D(a,b){c=b.split('|');d=false;for(q=0;q<c.length;q++){if(c[q]==a)d=true;}return%20d;}function%20E(){
f0=document.forms['addPassengerForm'];
...
0
votes
0answers
23 views
taking back a jquery script to original values
I'm using a jquery script that transforms a list in an animated bar chart
(function ($) {
"use strict";
$.fn.horizBarChart = function( options ) {
var settings = $.extend({
selector: '.bar',
...
0
votes
2answers
29 views
Filter in js that are less than < 50 characters long
I am working on simple js function...
GetShortMessages takes an array of objects with '.message' properties and returns an array of messages that are less than < 50 characters long.
Providing my ...
0
votes
0answers
14 views
JavaScript Slider - Customization from basics to fundamentals
I am building a JavaScript Slider for a Media Website and require a solid reference to optimize the code. Currently, it is based on a very simplistic design pattern - adapted from a codebase example. ...
0
votes
1answer
54 views
HTML <input> button(s) disappear on click
I am reading an XML file using JavaScript, and this part works as I am getting the data. Here is the XML file:
<bookstore>
<book category="romance">
<title ...
0
votes
0answers
11 views
JQuery Plugin - triggering internal functions by callback
Skip to bottom for question
JQuery plugin:
$.fn.myPlugin = function( options ) {
var options = $.extend({
myOption: true,
edit: function() {},
done: function() {}
}, ...
4
votes
4answers
66 views
How to assign empty value to select dropdown?
This works with Google Chrome and IE but not Firefox. For some reaons, Chrome and IE allow blank value to be assigned eventhough it is not part of the dropdown selection.
...
0
votes
0answers
27 views
pop up window not working in chrome [duplicate]
I am trying below code from years in my different projects for opening pop up.
But it stopped suddenly in all projects ..can any one give me reason..please help.
i also tried on another pc
var ...
0
votes
0answers
21 views
multiple click issue debounce wont work
I have a code which sends a mail if all the validations are proper. I simply need to block the user from clicking it multiple times. Hence i tried using debounce and confirmed that debounce is calling ...
0
votes
2answers
28 views
Infinite scroll for angular js
Hi for infinite scroll i have written a piece of code in javascript which detects the end of the window
$(window).scroll(function(){
if ($(window).scrollTop() == $(document).height() - ...
-1
votes
1answer
31 views
Javascript events on elements at same level
I have 2 svg elements in a group. Both belong to separate scope in object model.
Now, I want to capture mouse events on both the elements parallely.
Problem is I am getting event only to the top most ...
0
votes
2answers
24 views
Inserting redirection link (with JS) if not auto redirected within 3 seconds - is this a good method?
visitors of form.php submit a form with a foo value that should be a or b.
form is processed on redirect.php, which should send them right away (PHP header refresh) to a destination according to ...
2
votes
2answers
30 views
Event listener for dynamically created html
I am dynamically generating html, and I want the elements I add to have event listeners. The "board" div is in my html file, and I create the "myDiv" element. This part works.
var board = ...
7
votes
1answer
116 views
Meteor avoid double refreshes when third party widget changes it's own reactive datasource
I have a jsTree which I am trying to bi-directionally "connect" to a Meteor collection. Right now I automatically trigger a jsTree.refresh() whenever the collection updates with the help of ...
-2
votes
2answers
28 views
Regular expression in javascript for specific expression
I want to create an regex in php but I can't, I tried:
$sType = preg_replace('/ferm/','fermé', $sType);
So I need that after ferm to be any character
1
vote
7answers
96 views
How to set events in JQuery? [duplicate]
How to use events in JQuery?
I have 2 projects and in both projects I use different way to set events with JQuery.
In first project I use like this:
$("#someID").click(SomeFunction);
In second ...
2
votes
4answers
90 views
How I can know if a click event is counterfeit?
How I can know if a click event was generated by the user? (he used the mouse).
The opposite would be a click event triggered by a piece of javascript.
Think in a javascript library that displays ...
0
votes
1answer
25 views
Is it a bad idea to capture all click events in a single global event handler?
I have a project with hundreds of click events attached to various html items. I would muchly prefer to have a single handler attached to the body tag, that uses switch/case on the target id to ...
0
votes
0answers
48 views
Need help addEventListener and Object Oriented JavaScript: How to pass in argument and change its reference
Here is the jsfiddle to illustrate the problem.
http://jsfiddle.net/mabqc2zs/4/
(same code below):
JavaScript
var namespace = namespace || {};
namespace.ExampleClass = function () {
...
0
votes
2answers
22 views
how to access the Event Object in focusout Event Handler
sorry to ask such elementary question. I am learning Javascripts and Jquery.
I have a popup with 3 input fileds say ETD, ETA and duration. I am trying to calculate duration on focusout from ETD and ...