Replace space ' ' by '-' on keyup

Hello i have two inputs and when im writing in the first input, with keyup jquery function im writing automatically in the second input field. But I want to write line instead of space to the second input field when im clicking the spacebar. For ex...
more »

2017-02-13 22:02 (3) Answers

Carousel - associate text with images in slider

I am using Owl Carousel (https://owlcarousel2.github.io/OwlCarousel2/) for a simple carousel on my website. I'd like to have a different piece of text displaying over each image. As you can see, I can click the dots and they change which one is acti...
more »

2017-02-13 21:02 (2) Answers

forcing __proto__ equality

I want the prototype of these instances to be the same, but the following equality check evaluates to false. var emp1 = new(EmployeeScope())("John"); var emp2 = new(EmployeeScope())("Amit"); var mgr1 = new(ManagerScope())("Robert", "Data"); var mgr2...
more »

2017-02-13 20:02 (2) Answers

split() js last array item

I am newbie to web development and JS in particular. I am using a String object method split on this string: let str = 'Look at me '; //last character is space console.log(str.split(' ')); The separator for split is ' ' as well space. I expect to...
more »

2017-02-13 19:02 (5) Answers

Spring MVC 4 + Jackson + LocalDate

I am using Spring MVC 4 with Jackson API for databinding and I am having some issues while using Java 8 Dates, like LocalDate and LocalTime. Here is my Ajax: var response = $.ajax({ url: 'parcela', method: 'POST', data: { formaPagamentoPrazo: t...
more »

2017-02-13 18:02 (1) Answers

jQuery - insertBefore() for raw text

I use jQuery 1.11.2 and jQuery-migrate 1.2.1. Here is the simple example of what I'm trying to do: https://jsfiddle.net/bek3wrug/ I want to insert some text (not fully-wrapped into HTML tag) before some element on page, and jQuery only inserts the ...
more »

2017-02-13 10:02 (2) Answers

Search multiple strings in sentences

I try to search "ego d16" in a list like ego fara d16 ego d16 ego d22 d16 ego para ego dela d16 Must result in lines (1, 2, 4, 5)... My code is var filter = $(this).val(); //like 'ego d16' $("#rezultate li").each(function () { if ($(this)[0...
more »

2017-02-13 01:02 (3) Answers

Need an SVG workaround

I'm recreating blueprints as SVGs, as can be seen in this Pen. I'm obviously not finished, so the code is a bit sloppy right now since I've been experimenting with different workarounds in vain. One of the effects I have implemented is rooms will fi...
more »

2017-02-12 23:02 (1) Answers

Why is Chrome pulling old JS file?

I've been having a crazy annoying problem for a few weeks that I can't seem to solve. Occasionally when I update the Javascript or CSS files for my site hosted on Siteground, Chrome will refuse to recognize them. Other browsers will pull the new file...
more »

2017-02-12 22:02 (1) Answers

Elegant array transformation in Javascript

What's an elegent way - purely functional, ideally - to transform (reduce?) this array: var in = [ { a: 1, b: 'x', c: 'foo' }, { a: 1, b: 'y', c: 'goo' }, { a: 2, b: 'x', c: 'hoo' }, { a: 2, b: 'y', c: 'joo' } ] Into this: var out = [ ...
more »

2017-02-12 19:02 (5) Answers

Empty “this” in Sailsjs es6 arrow functions

I have a Sailsjs service class I declared my functions and everything is working fine not until when I tried to access this from within a function to call another, it was null. Doing some googling, I notice calling this in a function would print {}. ...
more »

2017-02-12 18:02 (0) Answers

Javascript innerHtml quiz results

I want to return the output of the score from a three button radio button quiz. I have the ouput working when I use alert but as the quiz is contained within a modal I don't want a popup I just want to display the output as within the modal to make i...
more »

2017-02-12 18:02 (1) Answers

Using this inside array of objects

I have an array of objects created with a constructor. This is the constructor definition: function Expander(elem, startingFlipped) { this.element = elem; this.flipped = startingFlipped; } (Below, rawElems is just a result of document.getEleme...
more »

2017-02-12 18:02 (1) Answers

Saving dropdown menu selection in a cookie

I saw this post - Saving dropdown menu selection in a cookie?. I got a dropdown menu which has 2 languages in it and when I press on one of them it changes the language, but the problem was, it always selects the top entry after refreshing the page. ...
more »

2017-02-12 18:02 (0) Answers

jQuery .find() inside .each() not working

Currently I'm stuck in a very basic jQuery problem. I think there's something I do not understand about jquery's .each(). So this is my code: $('.test-list .test-item').each(() => { console.log($(this).find('.test-paragraph').text()...
more »

2017-02-12 16:02 (1) Answers

Prevent navigation and get the target link

I want to make my website faster by changing the content code via Ajax instead of navigating and reloading the page. But I also care about non-Javascript users so I want to use normal links instead of onclick event. And I want to prevent navigating a...
more »

2017-02-12 15:02 (2) Answers

javascript asynchonously update a div

I need to show multiple images in a DIV in a web page one after another. There should be a time gap between two images. Here is the code I tried for that. $('#abc').prepend('<img id="theImg" src="D:/Image_Store/Character/Animal/Pet/cat2.png" />...
more »

2017-02-12 14:02 (1) Answers

create div where i click within the container

Here's a sample of creating a div next to the cursor position on click: view sample It creates a div where i click inside the container div but clicking too close to the borders creates a div beyond the container. Divs created should appear entirely...
more »

2017-02-12 13:02 (3) Answers