Hi Everyone !
How to open the link in new tab here…?
I need a code example… help me, please ))))
https://www.allbestgraphics.com/vegetables-clip-art
The Button “Download” connected with dataset. I need click the button and open the link in a new tab, help me please )))
buttons “Fruit” & " Vegetable I’m using this code -
export function button3_click(event) {
$w(“#myElement”).link = “http://wix.com”;
$w(“#myElement”).target = “_blank”;
from here - https://www.wix.com/corvid/reference/$w.LinkableMixin.html#
But this code doesn’t work for “Download” button…Lol
You should be using the itemReady property of your repeater:
and make sure you’re closing all your brackets to avoid parsing errors
H David! Awesome …!!!
but I tried using these codes -
$w(“#repeater1”).onItemReady( ($w, itemData, index) => {
$w(“#button2”).link = “https://www.allbestgraphics.com/Food-clipart/${itemData.title}}”;
$w(“#button2”).target = “_blank”;
} );
export function repeater1_itemReady($item, itemData, index) {
$w(“#button2”).link = “https://www.allbestgraphics.com/Food-clipart/${itemData.title}”;
$w(“#button2”).target = “_blank”;
}
$w("#image29"#image29").link = `http://easternstyles.com/Item/${itemData.someKey}`http://easternstyles.com/Item/${itemData.someKey}`; // someKey is just for example.
$w("#image29"#image29").target = "_blank";
$w(“#myRepeaterName”).onItemReady( ($w, itemData, index) => {
$w(“#myImageName”).link = https://myWebsite.com/myDynamicPage/${itemData.title}
;
$w(“#myImageName”).target = “_blank”;
} );
- it’s doesn’t work…)))) Lol
Also I found related posts -
https://www.wix.com/corvid/forum/community-discussion/need-repeater-element-to-open-dynamic-page-in-a-new-window
- and it’s doesn’t work…))))
Can you help me?
I just need a valid template!
Best regards N
Yes I am having the same issue please provide the code my ID is {houseID}
$w(" #myRepeaterName “).onItemReady( ($w, itemData, index) => {
$item(” #myImageName “).link = https://myWebsite.com/myDynamicPage/${itemData.link}
;
$item(” #myImageName ").target = “_blank”;
} );
If for whatever reason this is a Wix bug, you can use the same principle for a text element which should always work:
$item(‘#text’).html = <a href ="${itemData.link} target ="_blank">${itemData.title}</a>"
;
Ok!
Thank you very much !!!
Best regards Nataly
Can you publish an example with a ready-made template as here -
https://www.wix.com/corvid/examples
Yes please provide some example. It will be really helpful
I found related posts -
https://www.wix.com/corvid/forum/community-discussion/need-repeater-element-to-open-dynamic-page-in-a-new-window
https://www.wix.com/corvid/forum/community-discussion/open-dynamic-page-in-a-new-tab-when-click-on-repeater-image
- it’s doesn’t work…))))
Please publish a ready-made template
Thanks!
Sorry, but these templates can only be made by Wix team members as far as I know. In this case your error doesn’t seem to be coming from error within the code, just where you’ve placed it.
Make sure that in your code the only functions declared in the uppermost scope are $w.onReady and declared/exported functions. You cannot call a selector to do anything outside of these scopes.
@skmedia Hi !
Can you check the page?
Where should I look for my mistake?
I tried to use this codes-
$w(" #myRepeaterName “).onItemReady( ($w, itemData, index) => {
$item(” #myImageName “).link = https://myWebsite.com/myDynamicPage/${itemData.link}
;
$item(” #myImageName ").target = “_blank”;
} );
and from here - https://www.wix.com/corvid/forum/community-discussion/need-repeater-element-to-open-dynamic-page-in-a-new-window
Basically, you need to refer to the key that you have in the collection (I think this is always ‘title’).
$w(" #myRepeaterName “).onItemReady( ($w, itemData, index) => {
$w(” #myImageName “).link = https://myWebsite.com/myDynamicPage/${itemData.title}
;
$w(” #myImageName ").target = “_blank”;
} );
it’s doesn’t work, any help please!
this code on the page -
$w(“#repeater1”).onItemReady( ($w, itemData, index) => {
$w("#button2").link = "https://www.allbestgraphics.com/Food-clipart/${itemData.title}";
$w("#button2").target = "_blank";
} );
dynamic page -
https://www.allbestgraphics.com/Food-clipart/canned-fruits-vol.2
In you itemReady it should be $item, itemData, index, and use $item as the selector inside instead of $w. And no, it isn’t always title. You need to go to your dataset’s field and check to see what key you should be using when you click to modify that field. The title field is not a link.
Hi David!
where is here function - onClick?
$w(" #myRepeaterName “).onItemReady( ($w, itemData, index) => {
$item(” #myImageName “).link = https://myWebsite.com/myDynamicPage/${itemData.link}
;
$item(” #myImageName ").target = “_blank”;
} );
…
example from here -
https://www.wix.com/corvid/examples