I have a concept in mind, but I'm struggling to piece it together. I have bits of different methods that just don't seem to align.
That's why I'm reaching out for your expertise. Let's say I have 3 content containers with the classes: about, portfolio, and contact. The about container is visible while the other two are hidden.
What I'm trying to achieve is when I type certain words into a text box (or search box), such as "portfolio" or "portofoliu," and press enter, the about container will fade out and the portfolio container will fade in. The same effect should happen between about and contact.
I'm unsure how to implement this... Can anyone help? If you have a solution ready, providing a fiddle would greatly assist me in understanding how it functions.
Thank you
PS: One function that comes to mind is jQuery's .is() - comparing two elements. However, I'm not sure how to use it to compare with the text in the textbox.
I attempted the following code but it didn't work:
$("#portfolio").hide();
$("#wrong").hide();
$('#search').keyup(function() {
if ($("#portfolio").is("#search")) {
$("#portfolio").fadeIn();
}else{
$("#wrong").fadeIn();
}
});