WEBVTT

00:00.450 --> 00:06.540
So we have almost programmed the update button, the only thing that we have to do is to hide, update

00:06.540 --> 00:13.200
and delete buttons after clicking on update button, also display insert button back and update.

00:13.200 --> 00:15.350
The question in question is dynamically.

00:16.110 --> 00:22.560
So at first, when we click on update button, we need to clear question text area that the inputs for

00:22.560 --> 00:25.530
options and also make correct answer unchecked.

00:26.190 --> 00:26.640
All right.

00:27.000 --> 00:29.510
Let's start from a question text area.

00:29.550 --> 00:30.690
It's very simple.

00:31.230 --> 00:35.760
We just need to write inside, update question function dot items.

00:37.220 --> 00:39.110
That's new question text.

00:40.350 --> 00:41.400
That's a value.

00:43.090 --> 00:44.140
To two quotes.

00:46.860 --> 00:55.010
Let's go to the browser and see if it works, reload the page, click on edit, then check, answer,

00:55.080 --> 00:57.810
click on update and see that question.

00:57.820 --> 00:59.300
Text area is empty.

01:00.360 --> 01:07.680
OK, let's move on to options and also correct answer in order to clear all the inputs we need to use

01:07.680 --> 01:14.100
for a loop, so writes for then verbal I equals to zero, right.

01:14.640 --> 01:18.690
I's less than the length of option elements.

01:20.910 --> 01:22.290
And then I plus plus.

01:23.890 --> 01:30.730
So on each iteration, we need to clear the current option input and also at the same time we need to

01:30.730 --> 01:32.260
uncheck correct answer.

01:33.850 --> 01:36.670
For that, we have to write option elements I.

01:38.610 --> 01:41.460
That value equals to quotes.

01:43.820 --> 01:46.490
And below option elements, I.

01:47.890 --> 01:50.260
That previous aliments sibling.

01:51.310 --> 01:53.770
Docs checked the cost to false.

01:56.600 --> 02:02.330
All right, let's go to the browser again, reload, then click on Added.

02:03.650 --> 02:11.150
Check, answer, click on updates and see that text area and inputs are empty and also all the radio

02:11.150 --> 02:12.440
battles are unchecked.

02:13.800 --> 02:14.980
All right, fine.

02:15.690 --> 02:22.620
As we said, the next step is to make hidden updates and lead bottles also display inside bottle, which

02:22.620 --> 02:27.390
is hidden during editing questions and also enable clear at least button.

02:28.200 --> 02:28.650
For that.

02:28.650 --> 02:35.610
We just need to copy these lines of code and change the values with the opposite ones.

02:41.200 --> 02:45.070
So let's write instead of visible Chido.

02:48.820 --> 02:52.270
Then instead of hidden, right, visible.

02:54.200 --> 03:00.690
As for the points of events property, in order to enable clear at least button, we just need to place

03:00.710 --> 03:01.910
your empty quotes.

03:02.510 --> 03:11.540
All right, let's go back to Brazil one more time, reload, click on edit button, then check the correct

03:11.540 --> 03:15.700
answer, click on update and you see that buttons are hidden.

03:16.130 --> 03:22.490
Also here we have installed button back and the clear list button is enabled to prove that we just need

03:22.490 --> 03:23.870
to hover on that.

03:25.780 --> 03:31.150
OK, let's click again on edit button and change the text of question.

03:32.540 --> 03:33.860
Then update it.

03:35.210 --> 03:38.190
You see that question, text is not updated dynamically.

03:38.510 --> 03:41.140
For that, we need to reload the page.

03:42.050 --> 03:44.180
So let's fix that.

03:44.840 --> 03:45.890
Go to Brackett's.

03:47.730 --> 03:55.450
As it was in case of at input's dynamically function, we need to pass function as a parameter in added

03:55.450 --> 03:56.580
to question this method.

03:57.480 --> 04:03.990
This kind of functions in JavaScript sometimes are called s callback functions, and sometimes you may

04:03.990 --> 04:04.690
hear it.

04:04.710 --> 04:05.980
So don't be confused.

04:06.480 --> 04:12.030
Let's place your parameter and colleagues update question list function.

04:14.790 --> 04:17.010
Then go to controller module.

04:18.190 --> 04:21.220
And inside, it's questionable is the function.

04:23.140 --> 04:30.820
Plus, the proper argument, which will be you I controller, that creates a question list.

04:31.910 --> 04:39.020
And the last thing to do is to invoke this callback function, we have to do it inside, update question

04:39.020 --> 04:39.550
function.

04:40.160 --> 04:41.150
So that's right.

04:41.630 --> 04:44.510
Update's question, at least half an.

04:46.620 --> 04:49.080
This function should hold arguments.

04:50.200 --> 04:52.900
Let's place your storage question list.

04:55.770 --> 05:03.300
That's because we know that creates question, this function holds parameter gets questions.

05:05.210 --> 05:07.060
All right, everything is ready.

05:07.100 --> 05:15.560
Let's go to the browser of the page, click on adits, then change the text of the question.

05:16.600 --> 05:20.440
Check the correct answer and click on update.

05:21.940 --> 05:28.720
You say that the content of your question is updated dynamically and also everything works fine.

05:30.250 --> 05:31.550
All right, perfect.

05:32.140 --> 05:34.190
We have finished the program, the update button.

05:34.210 --> 05:37.900
It's time to move on to delete button, so let's go ahead.
