JavaScript - jQuery - Ajax
-
» JanMolendijkPleasant Coursesweb,
I have two `simple` javascript what I wanna combine between detecting in two different browsers to script to another page....Last post » JanMolendijkMarplo thanks for quick feedback took me more hours, I should have come earlier with asking questions.
It is a waste I`m not have experiance with...
-
» JanMolendijkPleasant Coursesweb,
The local storage for speech is limited to round 30 words.
But may also be limited to a number of characters ?
When I...Last post » JanMolendijkMarplo thanks for the suport.... Strange in Edge browser
the speech is unlimited but Chrome has big limits in speech.
-
» JanMolendijkHello,
On eatch minute from the current hour I wanna have an message
I can not find out how to complete
I hope to get something like this (code...Last post » MarPloIf you only want to display a message to every minute, just use the setInterval() function. It calls a function repeatedly, over and over again, at...
-
» JanMolendijkDear Coursesweb I can not find out how to add the hours + minutes togheter.
<SCRIPT LANGUAGE= JavaScript >
day = new Date()
hr =...Last post » MarPloSee and use the following example:
<script>
var day = new Date();
let hr = day.getHours();
let mn = day.getMinutes();
let se =...
-
» MarPloI have an array of integers:
var array = ;
Is there a simple way to remove a specific element from an array? The equivalent of something like:...Last post » drakebohanYou can use the arrayObject.filter() method :
net-informations.com/js/progs/remove.htm
Example, remove 1 specific item:
var rValue = 'three'...
-
» JanMolendijkPlessant Coursesweb,
meight useless to ask but it seems this upload for picture-album is not working on my mobile-page
but on my computer I just...Last post » MarPloTry to search on the internet for:
html multiple select upload mobile
-
» JanMolendijkPlessant Coursesweb, I have here an little script
what shows directly in a document from a base-url.
Now I would like to ad manual position...Last post » JanMolendijkMarplo Thanks alot, I just did not knewn what to do....
Other question how is your partner
from Coursesweb doing ?
I think I did not see him for...
-
» JanMolendijkPlessant coursesweb,
I have a javascript what turns color-codes into color-names.
The problem is I have 20 results from color-codes, and I can...Last post » MarPloTry use the following code:
<script>
const clr_codes = ;
var clr_rgb_name =[];
for(var i=0; i<clr_codes.length; i++){...
-
» MariusI'm trying to create a script for a web page that has an audio like this:
<div class='class1' id='id1'>
<audio src='link_to_audio'...Last post » MarPloSince the audio tag is a child of #id1 you can use document.querySelector() .
To set the volume to 50%, simply use audioElem.volume = 0.5;...
-
» MariusI am trying to parse a JSON string 'Hello test' containing double quote which already escaped.
JSON.parse('{ x : Hello \ test }')
But I get...Last post » MarPloYou just need to escape the backslash \, so it turns into two backslashes \\
let obj = JSON.parse('{ x : Hello \\ test }')
console.log(obj)
-
» MariusI have converted a database table into a JSON object.
This is in essence a two-dimensional array, with each record being the first dimension, which...Last post » MarPloYou can use Object.keys to get the list of keys in the Object as an array and then get the length from it:
Object.keys(act_obj_array).length;
-
» MariusQuick question:
How can I set a button that can increment and/or decrement at random a number as it is clicked?
This is the code i have....Last post » MarPloYou can use Math.random() to decide whether you are going to increment or not:
<button id='tst_btn'>Change counter</button>
<h3...
-
» MariusI'm trying to convert 8-bit integer to Hex color value. (e.g. FFFFFF)
The 8-bit color integer is generated with the following formula:
color =...Last post » MarPloIf you have an integer you can do with:
color.toString(16)
And it will turn it in to a hex string.
// White
color = (255 * 65536) + (255 *...
-
» MariusIn my application, I have a lot of utility functions that do little things from parsing strings to making toasts and so on.
My question is how do I...Last post » MarPloYou can use Mixins.
1. Import the component which you need.
2. add mixin array as below in your component just above the data section (or...
-
» MariusI have the following problem to solve it in JavaScript:
- Find the text which is between small brackets and shift that text with the brackets to...Last post » MarPloTry the following code:
function testToEnd(str){
//get matched string
let st = str.match(/ *\( +\) */g)
if(st){
st = st ;
// replace the...
-
» MariusI am creating a website with HTML and JavaScript that relies on the data of an XML file hosted on a separate domain.
I can achieve this with...Last post » MarPloTry using the the fetch api.
fetch('//example.com/file_address')
.then( response => response.text() )
.then( response => {
//response is...
-
» MariusI have a for() loop like this one which shows what i want to do.
for(var i=0; i<15; i++) {
// Add data in html
// When data has a specified...Last post » MarPloTo achieve your goal you can add the if() condition within the loop, and check the values of your data.
If it has the specified value, sets the new...
-
» MariusWith the good old for loop in Javascript I can do things like:
for (let i=0; i<bla.length; i+=2){
//...
}
So for every count, I can skip...Last post » MarPloYou may add an if() statement within the for...of loop, like in the following example (the original index is preserved).
for (const of...
-
» MariusHow can I make that when an option from dropdowna <select> list is selected, the value of that option be displayed into a Div.
I have this...Last post » MarPloYou have to start with a <select> element which raises a 'change' event when an option is selected.
Inside that event, 'this.value' refers to...
-
» MariusSay I have the following array of persons:
const arr =
And I want to find a certain person (name) in this array, and put it as the first...Last post » AdminYou could sort the array with the sort() method.
This approach moves all objects with the wanted 'name' to top.
const arr = ;
let first =...
-
» MariusI have a nested object in JavaScript that looks like this:
const yo = {
one: {
value: 0,
mission: 17},
two: {
value: 18,
mission: 3},...Last post » AdminTry combine the Object.values() and map() methods, like in the following example:
const yo = {
one: {
value: 9,
mission: 17
},
two: {...
-
» MariusI’m trying to replace all spaces within a string with hyphens.
I tried this:
let str ='This is my text';
str = str.replace(/\s/, '-');...Last post » AdminAdd the global search flag (/g ) to your regex to match all occurrences.
let str ='This is my text';
str = str.replace(/\s/g, '-');...
-
» MariusThe code below sends the 30s event do Google Analytics after 30 seconds a user enters a page.
setTimeout(function(){
gtag('event', '30s');
},...Last post » AdminYou can watch for when a tab loses focus by using the event listener 'visibilitychange'. When the visibility changes, you can use 'document.hidden'...
-
» MariusI have a JavaScript code that adds an input field for a user:
var user = O'Conner, John ;
b.innerHTML += <input type='hidden' value=' + user +...Last post » AdminYou can replace the character with its HTML entity.
As for ' - It can either be ’ or ‘
var user = O'Conner, John ;
user =...
-
» MariusThe idea is that when i click on a button, old content gets replaced by new HTML content added with javascript.
I want that new content to appear...Last post » AdminTo trigger a CSS transition, change the CSS state after you inserted the HTML. You can do this by changing a class (on the container or an inserted...