Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
I am trying to create a search variable taking the value of 2 others variables for search results
But I don't manage to get the expected result (title + author). In a sense where the author value is not taking into consideration.
How can I write the following correctly the get both correct values (title + author) in the search variable?
Thank you
let title = document.getElementById('titre-livre').value;
let author = document.getElementById('auteur').value;
let search = title + author;
Remember to separate these values with a space:
let search = [title, author].join(' ');
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 months ago.
Improve this question
Here is my page element:
Then I tried to pick up the value demo#.... from the element class name user-name using these code:
var x = document.getElementsByClassName("user-name")[0].innerHTML;
console.log("x is: " + x);
It would return me:
x is:
Any idea how to fix this?
Looking at your approach, the code innerHTML should have worked, there might be some other issue which might be occurring.
Like 1) there might be other tag with same class name, 2) the username value might not be updated when you called the function.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 months ago.
Improve this question
I want to be able to separate this one by one
Sephora26:theactor424#gmail.com:shpk335$A:what’s your name?:actor Dawg4075:dawg648#yahoo.com:Thoiland3:what’s your favorite pet?:cat Thrive65:evergreen45#hotmail.com:gcap1078!:what’s your favorite artist:Ed sheeran
I tried using JavaScript str.split() but it only parsed the first character (sephora26). What I want is to be able to parse the email and password out of it
Does it look like something you're looking for?
const strings = `Sephora26:theactor424#gmail.com:shpk335$A:what’s your name?:actor
Dawg4075:dawg648#yahoo.com:Thoiland3:what’s your favorite pet?:cat
hrive65:evergreen45#hotmail.com:gcap1078!:what’s your favorite artist:Ed sheeran`
const lines = strings.split('\n');
lines.forEach((line) => {
[name,email,password,question,answer] = line.split(":");
console.log(`name=${name}, email=${email}, password=${password}`);
});
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
I have a dropdown showing list of languages,
Now, some of these languages contains special HTML characters, but I want to show the real values of those characters.
Like.
è should be replaced with è
How to do this using Javascript ?
Thanks in advance !!
One way to do this:
const decodeHtml = (html) => {
const t = document.createElement("textarea");
t.innerHTML = html;
return t.value;
}
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
I have a phone number in iOS displayed in a list like :
home: (789)654-1281
I want to remove the home or any other category that will attach with the mobile number.I tried replace() in javascript,but it is not working.Please help.
I am developing hybrid application using kony.
Maybe you can try with something like this :
var number = 'home: (789)654-1281';
number = number.split(': ')[1]; // (789)654-1281
Hope it helps.
var input = "home: (789)654-1281"
var position = input.indexOf(': '); // with space
if (position > 0) {
var output = input.substring(position+2); // + 2 is length of ': '
}
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
How to add var in get value in JavaScript ?
I have 2 var
var page = $('#demoajax').val();
var name = $("#users").val();
This is mym old code
data:"server=Windows&actionfunction=showData&page="+page,
I want to add var name and value now=date to this line how can I do that ?
First I try this
data:"username="+name+"&server=Windows&actionfunction=showData&page="+page+"&now=date",
But not work.
You appear to have inserted your changes in the middle of the query string. Try this instead.
data:"server=Windows&username="+name+"&actionfunction=showData&page="+page+"&now=date",
Why do you have data:"username="+name+"&server=Windows&actionfunction=showData&page="+page+"&date=now",
switch date and now
Also lose the comma at end if not needed