All Questions
12 questions
-5
votes
2
answers
46
views
Replacing letters in a string using javaScript
function dnaStrand(dna){
const compl = dna;
dna.includes("A") && compl.replace(/A/g, "T");
dna.includes("T") && compl.replace(/T/g, "A")
dna....
1
vote
0
answers
138
views
Using Javascript to remove navbar links to current page. Why does it only work sometimes?
I am using include to load my main navigation and footer onto all the pages of my website. I am attempting to use javascript to, on page load, change the color of the current page's menu item as well ...
0
votes
1
answer
62
views
JS redirect function
I am trying to create a function that changes the redirect link of a button if the url contains the word "TicketPreDateable".
So I have a button like this one:
<div class="col-12 col-...
0
votes
2
answers
198
views
How do I link a Javascript file into another Javascript file
There are two files here in the same folder.
I am trying to invoke a function named greet of app1 in app2.
app1.html
<script>
function greet() {
alert('hello from App1')
}
// greet() ...
3
votes
0
answers
45
views
Disable javascript function "add class on scroll" on subsite with php included header
I'm trying to disable a JavaScript function on certain subsites that change navigation background and text-color on the scroll.
It's defined in the header.php which is included in all sites, but at ...
0
votes
1
answer
479
views
output elements of an array containing particular letter in javascript
I'm new to javascript and I'm struggling with getting the syntax right on my function to pull elements from an array containing the letter 'i'.
let teachers = ["Arrington", "Kincart", "Alberts", "...
0
votes
1
answer
8k
views
Method .includes() is not a function error
I am studying through Eloquent Javascript, and I have the following code as one of the exercices.
class Group {
constructor(){
this.arr = []
}
add(value){
if(!this.has(value)) {
...
0
votes
1
answer
41
views
Why can't I call any functions from a separate .js file?
If I have the following main.js file:
require('./test.js');
$(document).ready(function(){
testFunction();
});
and then the cooresponding test.js file in the same directory as main.js:
function ...
1
vote
1
answer
614
views
Why my toggle visibility javascript function is not working?
I have this folder structure:
htdocs/
- a.php
- plugin/
- b.php
- website/
- c.php
- js/
- common.js
I have these functions on common.js:
function togglevisibility (id)
{
...
0
votes
4
answers
5k
views
Javascript - include another script by using the <script> tag?
So I have a function that writes a string into a div.
The string is declared as content, which consists of html code, like this:
<h2>This is a test result</h2>
<script type="text/...
0
votes
1
answer
152
views
Wordpress - Custom page includes second custom page causing problems with functions file
Alright so I have a custom page template designed with javascript and php (lets call this page1). The javascript inserts a second custom page (page2) template which displays content inside a div ...
-1
votes
1
answer
176
views
Including javascript file dynamically and then calling function dynamically
I've included a javascript file dynamically, here is the file http://www.zaarly.com/anywhere.js
When I call the Zaarly.Anywhere.Open() function I get this error
Zaarly.Anywhere is undefined
If I ...