Hello!
I have a dynamic page that includes 3 buttons for downloadable content (ex. PDFs, PowerPoints, etc). Depending on the entry, there could be anywhere from 0 - 3 downloads available.
Can someone help me write code for the 3 buttons so that they are hidden if there is no content in the database? This is what I have so far - but it doesn't seem to want to work. It makes the buttons disappear, but does so regardless if there is content in the field or not.
*Note: I have a text box called "noneAvail" that shows up if there is no downloadable content.
Thanks,
Wanda
$w.onReady(function () {
$w("#dynamicDataset").onReady( () => {
if($w("#down1").link !==null){
$w("#down1").hide();
$w("#noneAvail").show();
}
if($w("#down2").link !==null){
$w("#down2").hide();
}
if($w("#down3").link !==null){
$w("#down3").hide();
}
if($w("#survey").link !==null){
$w("#survey").hide();
$w("#feedback").hide();
}
});
});
Hey there ...
This is an old post and will be closed. Please open up a new thread with your own questions/ideas.
Hey Kristof, Thanks for your help. I changed it to link <---totally makes sense (I did try link before but another example showed me label. I tried both "" and null, with not luck. I am probably writing it wrong. When trying either ("" or null) I get the social button missing (from all) and the email one always present. This is the latest attempt. $w.onReady(function () { $w("#vendorDataset").onReady( () => { if($w("#email").link === ""){ $w("#email").hide(); } if($w("#socialMedia").link === ""){ $w("#socialMedia").hide(); } }); }); (above results)
Thanks again. Any help is appreciated. I am doing this website for free because the store is in need of desperate support. Covid stinks. I am sure you all get it
Regular/Normal.
This didn't work for me unfortunately. $w.onReady(function () { $w("#vendorDataset").onReady( () => { if($w("#email").label ===''){ $w("#email").hide(); } if($w("#socialMedia").label ===''){ $w("#socialMedia").hide(); } }); }); I still see all the buttons whether they have content in the database or not. You can tell because when you roll over the images you can't see a link on some. Dataset Name:
Button Names:
Anyone have a follow up for this. Here is the reference page: www.thequeensmarketshop .com/vendors
Here is an image of the database showing blank entries.
Hi everybody.
I am looking for a condition that will show a shop gallery on my cart page only if there is a minimum purchase sum. (The idea is that customers who purchases above a certain amount, will be able to choose a free product from a specific gallery)
Any ideas?
Thanks and take care!
You might want to check out the documentation also: https://support.wix.com/en/article/how-to-hide-an-element-on-certain-pages
Hey Wanda , thanks for sharing this! I was looking all around for this like a mad man I appreciate you even more for following up. Thanks again.
Well - once again, trial and error won out, and I finally got something to work.
In case anyone is looking here for a solution, this is what I ended up with:
if($w("#down2").label ===''){ $w("#down2").hide(); }
Luckily, I had given each downloadable content a title in the database that I would then use as the label for the button - I was able to reference that to see if it was blank. Works like a charm.
Can anyone help? Any suggestions are appreciated!