Bug? 2 Simple Strings Not Comparing

Hello, I’m new to Wix Corvid. I’ve coded mostly through Wordpress, so I do not understand why the following code is not working. If anyone could walk me through this, it would be greatly appreciated. Thanks!

UPDATE: I have kept researching what could be the problem, and it seems like Wix doesn’t like comparing #primitivevalues to objects, so I tried to use the #String constructor on t1, but Wix didn’t like that either. What I decided to do next is to create another text object with the same text so that I could #compare the two objects, but now that doesn’t want to work either. What it does is it logs what’s in the comments, but it will still say that x !== t1 and change it to 722 Tractor ONLY (Electric). Here is my current code with comments:

Current Code:
export function iconButton1_click(event) {
$w(‘#text26’).show();
}

export function text18_mouseIn(event) {
var x = $w(‘#text18’); // 722 Tractor ONLY (Recoil)
var t1 = $w(‘#t1’); // 722 Tractor ONLY (Recoil)
console.log(x + " || " + t1); // [object Object] || [object Object]
console.log(x.type + " || " + t1.type); // $w.Text || $w.Text
console.log(x.text + " || " + t1.text); // 722 Tractor ONLY (Recoil) || 722 Tractor ONLY (Recoil)

if (!$w(“#text26”).hidden && x.text === t1.text) {
$w(‘#text18’).html = “722 Tractor ONLY (Recoil)”;
} else if (!$w(“#text26”).hidden && x.text !== t1.text) {
$w(‘#text18’).html = “722 Tractor ONLY (Electric)”;
}
}


Original Code:

export function text18_mouseOut(event) {
var x = $w(‘#text18’).text;
var t1 = ‘722 Tractor ONLY (Recoil)’;
console.log(x); //logs 722 Tractor ONLY (Recoil)

if (x === t1) {
$w(‘#text18’).html = “722 Tractor ONLY (Recoil)”;
} else if (x !== t1) {
console.log(t1); //also logs 722 Tractor ONLY (Recoil), but for some reason it is not registering that they are both the same text. Then the next line will change it to (Electric).
$w(‘#text18’).html = “722 Tractor ONLY (Electric)”;
}
}

If anyone needs more information, please let me know.

I’m not sure I got the problem. Can you elaborate?

Yes, sir. So, I am trying to create a drop down menu with text, and I am trying to have it only change the text when the text is clicked. The problem is that the text is changing from (Recoil) to (Electric) when I move the mouse out for some reason without clicking the text and am trying to figure out why.

Ideally, I click the drop down image, it shows the second text option (Electric), and if I click on (Electric), it will adjust the price, change the first text to (Electric) and second to (Recoil) and then hide (Recoil) since (Electric) was clicked on.

In the code above you used a mouseOut() function, so why are you expecting it to act as an onClick() function?
I’m probably missing something.

No, the onClick() function is another function which contains its corresponding code. The problem is found in this chunk of code, which is what’s mind-boggling to me.

In other words, you can disregard that second paragraph as I did not include all the code to run the whole program, but I’m having issues with this section of it.

Bump