P
P
pablo_2282020-03-24 09:58:55
JavaScript
pablo_228, 2020-03-24 09:58:55

How to change text on button click wix(corvid)?

Good afternoon everyone!
Please tell me how can I change the text of another element by clicking on an element?

//у меня есть кнопка с id = "button1"
//нужно изменить допустим HTML элемент с id = "html1"
export function button1(event) {
     //???
}

Thanks in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladislav, 2020-03-24
@pablo_228

You put a click event on the button.
Code is generated.
Then you access the element through the $w variable and set its text property to the value in my case #text is the H1 heading. You can do the same with any other element on the page
Syntax is similar to C#

export function button1_click(event) {
  $w('#text1').text = 'Hello world';
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question