Newest javascript Questions

Q&A for professional and enthusiast programmers

Timer for a traffic light animation (Javascript)

I'm trying to create a traffic light animation, previously I used a button to change the lights, and now I want to keep the animation running without needing to press any buttons. <!DOCTYPE html&...

TypeScript/JavaScript array value push

I have this objet : keyValue : { key : string , value : number}[]; I want to add a new element to this array from two values, like this : let tmpTabKV : { key : string , value : number}[]; [....

Getting $index from option in ng-change inside select tag

I see there are a lot of questions similar to this one, but I couldn't find any that requires exactly what I have: ngRepeat inside option-tag ngChange inside select-tag I need to get the index of ...

Inserting MAX +1 to New Value in Database

I am pretty stuck on this so your help would be appreciated. I currently have a button that can be pressed that brings up an HTML popup box. The popup box has 2 input fields, SKU Group and Group_ID. I ...

Add captcha dynamically to login form

i have one login page with text boxes username,password respectively and submit button fields.I want a captcha should be add dynamically in the samelogin page after one login attempt failed.Login page ...

XMLHttpRequest: Network Error 0x2eff, Could not complete the operation due to error 00002eff

I'm working on an AngularJS project and implemented the file upload functionality as follows (this is the service): class RegressionService { private httpService: ng.IHttpService; private ...

Changing the hide show toggle effect?

I have an element that works just fine with the following code. It's an object #obj1 that is hidden when loading the page, but appears when clicking on #obj2. #obj1{ position:fixed; width:...

My script doesn't work properly and doesn't give an error

Hi I was just trying to make a button that slides up and down with JQuerry but it works 50%. When I press "Slide up" it does work but it doens't work with "Slide down". It doesn't give me any errors ...

Is there a way to access propTypes and defaultProps of an imported component?

When I look at this page, I can see a table containing the propTypes and defaultProps for a component : http://styleguide.pivotal.io/react_components_alerts.html I want to do the same thing for a ...

Set current multiple value in selectize JS

I have problem in selectize JS when set current value is multiple value. I set from Ajax response in Json format, here is my code. $(".rule_list").on("click",function(e) { e.preventDefault(); ...

Convert ismv to mpeg-dash with node js

I'm trying stream live video from ip camera to HTML 5 video teg. I encoding stream with ffmpeg. The comand is. $ ffmpeg -rtsp_transport tcp -an -i "rtsp://192.168.1.10:554/user=admin&password=&...

Unit testing Angular 2 JS code without using Karma

I am trying to execute the unit test cases from QuickStart Seed from Angular official site. I want to start using only Jasmine for unit testing so I have removed karma references from the project. ...

Multiselect does not fire change events on mobile devices when clicking the option

First, the code: $('#residentialobject-filter-form-modal select, #residentialproject-filter-form-modal select').on('change', function (e) { if ($(this).val() == null || $(this).val() == '' || $....

Extract the Id's number of multiple elements jQuery

I have this simple code $('[id^=pz]').change(function() { //Getting the numbers after the letters "pz": //1 //2 //100 }); <input type="text" id="pz1"> <input type="text" id="pz2">...

Jquery- Find a word in a sentence and add span

I am writing a function to find word in a sentences and add span on top. This is the code but it is not working. Can anyone point out my mistake? Thanks function find_and_add(element = "", ...

React: Can't export const

I'm trying to one line export const my <SearchForm/> but for some reason it's erroring out. Here is my code import React from 'react'; export const SearchForm = props => ( <form ...

Detect Youtube iFrame state changes (play/end/etc…)

Everything is in the title, I "just" would like to detect when my YouTube iFrame state is changing. I'm using the API to search and display a set of 10 videos (with youtube.search.list), so I'm ...

Vue.js debounce scroll

I am trying to use the debounce package with a Vue.js v-on:scroll binding like so: <div @scroll="debounce(onScrollMessages, 200)"></div> The problem is that debounce actually returns ...

Unable to connect to RabbitMQ broker using MQTT.js

I am using MQTT.js to connect to the Rabbitmq broker, I'm using right connection details, still unable to connect and publish messages. Please help! var mqtt = require('mqtt'); var client = mqtt....

ES6 destructuring: Array reordering mechanism

I was reading through Kyle Simpson's book (You don't Know JS - ES6 and beyond) and he gives this example on reordering arrays: var a1 = [ 1, 2, 3 ], a2 = []; [ a2[2], a2[0], a2[1] ] = a1; ...

How to disable the calender popup from bootstrap date picker using jquery?

How to disable the calender popup from bootstrap date picker using jquery?? $("#id").val('').attr('disabled',true).trigger("liszt:updated"); is not working also .prop is not working..

Reload window on resize browser window

I want to reload the page on browser resize only, I tried the following code it's loading the browser again and again however I am not resizing the browser window. $(window).on('resize',function(){ ...

keypress fail to work on mobile browser

This Meteor client event works fine on desktop browser but fail to do the same on mobile browser "Chrome". It detects the key entry of "g" after "@" and replace it with "@gmail.com". Any idea how to ...

I dont want the toggle functionality when the target is the same

I'm trying to create a step by step order, and I'm using data-id="x" to tell which content to be visible when it has been selected. What I am trying to accomplish is if the data-id has the same ...

Leaflet layer switcher on click

I would like to open the Layer switcher control in leaflet 1.0 on click instead of hover. The example is here: http://leafletjs.com/examples/layers-control/ I tried extending the L.Control.Layer and ...

Meteor how to pass the data of an array in another array

I am trying to make a form where you have a list with the names of your friends to invite them every name with a checkbox i already get the data and insert the data in a collection as an array but now ...

Check to make sure all fields are filled Jquery

I'm trying to make an easy validator in jquery for my input fields. Currently i got the following: function checkInputs(){ var isValid = true; $('.input-required').each(function() { if($(this)....

Input programmatically text in fields in webview after load page

I have some issue about WebView. I have some page. This page have two input fields. We can input some text in field when the page is loading. But, can I set this fields after loading? For example, ...

block jsp page using javascript

how to block a jsp page (i want is ,when I click the links to redirect each pages I want to block some specific pages for specific users) I create an java script function to retrieve the jsp pages ...

JSON key - Value

I have the following JSON Object [ a: "123" b:"$a" ] b should always have the value of a. Any idea of how i can make it with javascript? Thanks in advance Aline

Within the email sent by an online form, respect the line break entered into text-area of the form

I am using the code below. When the website user fills in the form, the email I receive does not show the line breaks as they are added by the user in the text area (message_content). How can I ...

How to prevent all radios and checkboxes on my webpage from turning into bootstrap switches

I have included the bootstrap switch JS on webpage. It is causing ALL radio and checkbox inputs to turn into bootstrap switches. Is there any way I can control this behaviour so that only some of the ...

How to get the Value Returned From Knex (Object in an Array thats in an Array)

I'm using a knex.raw query that ends with .then(aTotal) to get a count of a particular field matching the query. knex.raw('This is my query').then((aTotal) => { console.log(aTotal) }) The ...

Three.js: global rotation

I want to rotate all objects in a scene around the origin 0,0,0 along the x axis. However, setting obj.rotation.x += 0.1; doesn't rotate along the origin, but along the the center of the object ...

How to filter the “Legend” and the “Mouse Clicks” on the same way as the “Slices”?

Basicly what I try todo is count the total DURATION for specific events from the Events Table and put the results in A pie chart (See Printscreen ) //1 Open Table cf = crossfilter(table); dValue1 = ...

upload functionality of image in JqGrid.js

I have multiple column in my jqgrid and i want the inline editing functionality. I have one column where image is going to be displayed and if user click the image it should provide the functionality ...

Embed hmtl and javascript in Google Sites

I have created a small hmtl page with java script in it. It works fine when you open it with any browser. Now I would like to include this page in my Google Site (https://sites.google.com...) but it ...

Add ng-maxlength to input after loading data

When user is entering the view. Angular is sending request to server and in response is name which consists of prefix and actual name (e.g.: PREFIX_NAME). In view I have 2 inputs (one for prefix and ...

React/Redux - Sate - Unable to get property X of undefined or null reference

I'm trying to create a Login page as the index but I've been struggling to understand the redux's reducers and stores. There is an error that I'm not being able to resolve: SCRIPT5007: Unable to ...

Object Literal Pattern: can't access a data attribute when binding events

Background: I am trying to dry up my code using the object literal pattern. The object: Here is my object: (function(){ var bookingForm = { init: function(){ this.cacheDOM()...

Add a row instead of scrolling right in textarea

How can I add a row in a text area instead of scrolling to the right when the text is too long? thanks

How to add some text to end of document title with JavaScript?

I have basic html like this: <html> <head> <title>Page name @</title> </head> </html> After "@" thing I need to have domain name ("EKS.RU"), and I think that JS ...

Javascript randomly replacing my string?

I am trying to work out why Javascript is replacing the character \ with , in my string after splitting it by . I have a websocket sample code that I receive messages and split them by \ for each ...

<script> does not able to load another js file in the page

I am trying to access this url via javascript to loaf a function in my js page: url which contains a function Then I will easily call the function and load some info. I have the following code: ...

build XML format from JSON in JavaScript

I'm trying to generate an XML format based on my JSON, not trying to convert it from JSON to XML. An example of JSON I'm trying to generate to XML var jObj = { "Smart Shoes":{ "Product":"...

Reverse Javascript triggered CSS animation

This may be a stupid question but I am struggling. I want a slide in-out navigation menu for small screens, triggered by javascript. This is what I currently have: HTML <nav class="responsive">...

I did a small function to sort numbers in javscript just “for fun” and i would like to ask for tips to improve it [on hold]

I did a function that ask for an array of values, and sort them, and I would like to ask for any tips to improve it or any method to do it better, also I probably missed some issues with my code and I ...

How to store the URL and separate each of the word

Hi I know how to store the URL parameters using the below JavaScript but is there a way to store each word after the slash. Example: I have the URL: http://localhost:9000/Database/Users/username/...

JQuery accesses only the first item in the class

I am using Kendo UI, and what i am doing is refreshing the charts by class so that i can refresh all charts without accessing each one by ID. this is the code: $(".k-chart").data("kendoChart")....

Three.js - THREEx - font.generateShapes is not a function

I'm trying to add a text to my scene like this: var mesh = new THREEx.Text('THREEx', { font : "droid serif", weight : "bold", size : 1, ...
Translating... 0%