Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Browsing all 142075 articles
Browse latest View live
↧

Javascript: find longest word in a string

function longestWord(string) { var str = string.split(""); var longest = 0; var word = null; for (var i = 0; i < str.length - 1; i++) { if (longest < str[i].length) { longest = str[i].length;...

View Article


Hidden element, 1 sec delay

I have a div element that I want to hide if the value of the option list is not equal to 1. I'm using the jquery to hide/show the element. if ($("#prov").val() == "0") { $("#label1").hide();...

View Article


Set selected display value of select option box

I want to make a selection in my drop down where the display text is different than the actual value. Once I make my selection I want the actual HTML that is displayed in the SELECT box to show the...

View Article

Webpack production version of website points to the wrong directories

I have two npm commands "build": "webpack --mode production" and "start": "webpack-dev-server --mode development --open". When I run the start command the web application runs as intended with all the...

View Article

Is there a js fuction or html property to format text into input area?

Can anyone help with the code bellow? It doesn't load the whole text into the specific input. Try to type 5.9 ph and show explanation and you will see the test comes in one line and I would like the...

View Article


Conflict when simultaneously using keyboard events for scrolling and CSS...

You can horizontally scroll my demo page by pressing Space Bar, Page Up / Page Down and Left Arrow / Right Arrow keys. You can also snap scroll with a mouse or trackpad.But only one or the other...

View Article

Socket.io: Socket.emit inside an event listener is working pretty weird

the problem in a nutshell is:socket.emit('test2') inside socket.on('test1') is not working if the event 'test1' is fired with socket.on('test1') inside an event listener function in the browser.process...

View Article

How to pass pdf binary (decoded bas64) as varbinary(max)

Hi I was trying to send the decoded base64(binary) value to sql update query as varbinary(max) I can able to generate the pdf, by decoding the base64 using atob(base64).I tried many ways to pass the...

View Article


Cypress getByTestId, queryByTestId, findByTestId to check if element doesn't...

I am trying to check if element doesn't exist in a DOM Tree with Cypress.If I try to do cy.getByTestId("my-button").should("not.exist") test fails because it couldn't find element. If I do...

View Article


How can i display the ip address exposing an express.js development server to...

When I start up a basic express.js server I usually console.log a message that says it is running and listening on port .const express = require('express'); const app = express(); const port = 3000;...

View Article

How to change the table content dynamically in html using js

I found a code here to change the table content dynamically The script is in jQueryOriginal jQuery code to change the table content dynamically$(document).ready(function(e) { var data1 = [ { field1:...

View Article

Using materialize-css in express/react SSR app

I have an express server that uses Server Side Rendering (SSR) to render a react app.I want to use the materialize-css package together with my react app.I have imported the...

View Article

Image may be NSFW.
Clik here to view.

Create plane from polyline points using threejs

I am trying to achieve something like this:I followed solution from this post Extruding a line in three.js but when I try this it renders nothing.Here is the code which I tried:let containerThreeJs =...

View Article


How to effectively concat Uint8Array?

I'm trying to create a GIF image from scratch on the browser. It all works, but it get a lot of time to build small image which feels underwhelming. (2.6s for a 300x200 with 100 frames on a high-end...

View Article

Unable to sort arrays in Javascript

I am trying to print the unique elements in an array first followed by another iteration using do-whilevar arr1 = ['a1','a2','a3,' ,'b1', 'b2' , 'c1' , 'c2']; var arr2 = []; var userInput = 7; do{ for...

View Article


Catch 403 error when retrieving module through import()

This is a pretty straightforward issue, so I'm surprised I can't find it here.Let's say I have the following code to import a module:import("mymodule.js").then(module => { // Use module }).catch(e...

View Article

Is there a way to search a field in a JSON array that can contain multiple...

I have an ajax query that returns results and should display them in an html table like the below:<input type="button" value="Customer" onclick="SelectCustomer()"> <input type="button"...

View Article


vueJS how to import and load components dynamically as a list is rendered

I have a list being rendered.<div v-for="msg in messages"> <div v-if="msg.type==='component'"> <component v-bind:is="getComponent(msg.component)" :data="msg.data"...

View Article

How to display RSS Feed (Google Alerts) on my Vue.js page?

I am having difficulty displaying a series of articles on my vue.js app.I am not sure if this is the correct method or not. I have imported axios as a way to do so. I am trying to display the following...

View Article

p5.js a problem when using setInterval, array.push(), for loop to create...

Using setInterval, array.push(), for loops, I want one bubble to appear every 3 seconds until the length of the array bubbles becomes 10.However, when I execute my code, 10 bubbles appear altogether at...

View Article
Browsing all 142075 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>