Hi,
I have a dynamic page where the title (h1) is generated based on the title of a hotel name. Then on the same dyanamic page, I have a form which users can submit. As I want to know from which page they submitted the form, I need to put the h1 name into a field of the form.
So let's say the h1 title is "Sheraton New York City" I would like to take this input and save it as #input5 of my form which is on the same page below a picture of the hotel.
I tired the following, but it is not working
import wixSite from 'wix-site';
;
$w.onReady(function () {
let myTitle = $w("#title").text;
console.log(myTitle)
//$w("#input5").value = myTitle;
});
It returns "title" but not the actual title which comes from the dynamic page and can change depending on what the user selects.
Anyone have an idea?
Kind regards
Sven
There are other easier ways where you can simply use Wix Storage to save the specific data and then have it show again on another page.
https://www.wix.com/corvid/reference/wix-storage.html
You can find previous posts here about that.
https://www.wix.com/corvid/forum/community-discussion/help-how-to-pass-data-from-one-dynamic-page-to-another
https://www.wix.com/corvid/forum/community-discussion/solved-wix-storage-transferring-data-between-pages
Or you can simply use code to pass data from your page to a lightbox instead.
https://www.wix.com/corvid/reference/wix-window.lightbox.html
Again there are many previous posts that you can see for this too.
https://www.wix.com/corvid/forum/community-discussion/pass-data-from-repeater-into-dynamic-lightbox
Plus, Nayeli (Code Queen) has done a tutorial on it too that you can view.
https://www.totallycodable.com/wix/corvid/open-a-lightbox-when-clicking-an-item-in-a-repeater-using-a-button