Matt
Matt
KPCKevin Powell - Community
Created by Matt on 4/19/2024 in #front-end
How to get a string within a string (JS)
This has been a complete head ache lol
13 replies
KPCKevin Powell - Community
Created by Matt on 4/19/2024 in #front-end
How to get a string within a string (JS)
That's awesome wow. Thank you very much
13 replies
KPCKevin Powell - Community
Created by Matt on 4/19/2024 in #front-end
How to get a string within a string (JS)
I was thinking of adding a condition to check for those 1 off characters separately
13 replies
KPCKevin Powell - Community
Created by Matt on 4/19/2024 in #front-end
How to get a string within a string (JS)
let currentUrl = window.location.href;

function getQuery(currentUrl) {

let endIndex, searchValue;

let startIndex = currentUrl.indexOf("search_query=");
if (startIndex !== -1) {
startIndex += "search_query=".length;

if (currentUrl.includes('&')) {
endIndex = currentUrl.indexOf("&", startIndex);
} else {
endIndex = currentUrl.lastIndexOf(currentUrl.length);
}

searchValue = currentUrl.substring(startIndex, endIndex !== -1 ? endIndex : undefined);

if(searchValue.includes('%20')) {
searchValue = searchValue.replace('%20', ' ')
}

return searchValue;
}
return null;
}

// Extract the search value
let searchValue = getQuery(currentUrl);

if (searchValue !== null) {
searchBar.placeholder = searchValue
}
let currentUrl = window.location.href;

function getQuery(currentUrl) {

let endIndex, searchValue;

let startIndex = currentUrl.indexOf("search_query=");
if (startIndex !== -1) {
startIndex += "search_query=".length;

if (currentUrl.includes('&')) {
endIndex = currentUrl.indexOf("&", startIndex);
} else {
endIndex = currentUrl.lastIndexOf(currentUrl.length);
}

searchValue = currentUrl.substring(startIndex, endIndex !== -1 ? endIndex : undefined);

if(searchValue.includes('%20')) {
searchValue = searchValue.replace('%20', ' ')
}

return searchValue;
}
return null;
}

// Extract the search value
let searchValue = getQuery(currentUrl);

if (searchValue !== null) {
searchBar.placeholder = searchValue
}
13 replies
KPCKevin Powell - Community
Created by Matt on 4/19/2024 in #front-end
How to get a string within a string (JS)
I actually just finishing making a solution doing nothing close to this. I'm still new to JS but this is what I came up with 😅
13 replies
KPCKevin Powell - Community
Created by Matt on 4/19/2024 in #front-end
How to get a string within a string (JS)
Thank you, I was oblivious to this approach
13 replies
KPCKevin Powell - Community
Created by Matt on 4/19/2024 in #front-end
How to get a string within a string (JS)
I might be explaining this horribly, but the goal is to create a search bar that works with filtering functions for a catalog. Right now I'm trying to pull the user's query in order to display as the input's placeholder after they search
13 replies
KPCKevin Powell - Community
Created by Matt on 4/11/2024 in #front-end
CSS Grid Issue
And container has height because there’s there’s fixed height on aside filter
6 replies
KPCKevin Powell - Community
Created by Matt on 4/11/2024 in #front-end
CSS Grid Issue
There’s no width on card
6 replies
KPCKevin Powell - Community
Created by Matt on 3/25/2024 in #front-end
Force Overflow Scrollbar to be visible on mobile
Thank you
9 replies
KPCKevin Powell - Community
Created by Matt on 3/25/2024 in #front-end
Force Overflow Scrollbar to be visible on mobile
Ah okay
9 replies
KPCKevin Powell - Community
Created by Matt on 3/25/2024 in #front-end
Force Overflow Scrollbar to be visible on mobile
I'm just trying to make it visible all times
9 replies
KPCKevin Powell - Community
Created by Matt on 3/25/2024 in #front-end
Force Overflow Scrollbar to be visible on mobile
The scroll bar is visible when you touch and drag on the element
9 replies
KPCKevin Powell - Community
Created by Matt on 3/25/2024 in #front-end
Force Overflow Scrollbar to be visible on mobile
I haven't been able to test on other browsers
9 replies
KPCKevin Powell - Community
Created by Matt on 3/6/2024 in #back-end
Installing a library with JS
Thank you @Heitor
29 replies
KPCKevin Powell - Community
Created by Matt on 3/6/2024 in #back-end
Installing a library with JS
No worries!
29 replies
KPCKevin Powell - Community
Created by Matt on 3/6/2024 in #back-end
Installing a library with JS
do you have node isntalled?
29 replies
KPCKevin Powell - Community
Created by Matt on 3/6/2024 in #back-end
Installing a library with JS
ive no idea lol
29 replies
KPCKevin Powell - Community
Created by Matt on 3/6/2024 in #back-end
Installing a library with JS
hmm
29 replies
KPCKevin Powell - Community
Created by Matt on 3/6/2024 in #back-end
Installing a library with JS
@Heitor What npm commands did you run?
29 replies