So we have almost programmed the update button, the only thing that we have to do is to hide, update
and delete buttons after clicking on update button, also display insert button back and update.
The question in question is dynamically.
So at first, when we click on update button, we need to clear question text area that the inputs for
options and also make correct answer unchecked.
All right.
Let's start from a question text area.
It's very simple.
We just need to write inside, update question function dot items.
That's new question text.
That's a value.
To two quotes.
Let's go to the browser and see if it works, reload the page, click on edit, then check, answer,
click on update and see that question.
Text area is empty.
OK, let's move on to options and also correct answer in order to clear all the inputs we need to use
for a loop, so writes for then verbal I equals to zero, right.
I's less than the length of option elements.
And then I plus plus.
So on each iteration, we need to clear the current option input and also at the same time we need to
uncheck correct answer.
For that, we have to write option elements I.
That value equals to quotes.
And below option elements, I.
That previous aliments sibling.
Docs checked the cost to false.
All right, let's go to the browser again, reload, then click on Added.
Check, answer, click on updates and see that text area and inputs are empty and also all the radio
battles are unchecked.
All right, fine.
As we said, the next step is to make hidden updates and lead bottles also display inside bottle, which
is hidden during editing questions and also enable clear at least button.
For that.
We just need to copy these lines of code and change the values with the opposite ones.
So let's write instead of visible Chido.
Then instead of hidden, right, visible.
As for the points of events property, in order to enable clear at least button, we just need to place
your empty quotes.
All right, let's go back to Brazil one more time, reload, click on edit button, then check the correct
answer, click on update and you see that buttons are hidden.
Also here we have installed button back and the clear list button is enabled to prove that we just need
to hover on that.
OK, let's click again on edit button and change the text of question.
Then update it.
You see that question, text is not updated dynamically.
For that, we need to reload the page.
So let's fix that.
Go to Brackett's.
As it was in case of at input's dynamically function, we need to pass function as a parameter in added
to question this method.
This kind of functions in JavaScript sometimes are called s callback functions, and sometimes you may
hear it.
So don't be confused.
Let's place your parameter and colleagues update question list function.
Then go to controller module.
And inside, it's questionable is the function.
Plus, the proper argument, which will be you I controller, that creates a question list.
And the last thing to do is to invoke this callback function, we have to do it inside, update question
function.
So that's right.
Update's question, at least half an.
This function should hold arguments.
Let's place your storage question list.
That's because we know that creates question, this function holds parameter gets questions.
All right, everything is ready.
Let's go to the browser of the page, click on adits, then change the text of the question.
Check the correct answer and click on update.
You say that the content of your question is updated dynamically and also everything works fine.
All right, perfect.
We have finished the program, the update button.
It's time to move on to delete button, so let's go ahead.