I have two fields with the name of price and discountedPrice in a model. The thing that I want is to get the values of these two fields on their change to calculate the discount percent from them and showing the discount percent before the admin clicks on the save button.
Asked
Active
Viewed 23 times
0

Mark Rotteveel
- 100,966
- 191
- 140
- 197
-
Not completely, because the html content includes several tags such as img, etc but in this link only the answer of showing a text is written. – Ali GhiasvandMohammadkhani Aug 19 '22 at 11:46
-
Hello @Ali here is one more [example](https://stackoverflow.com/a/70373394/14457833) which uses ckeditor – Ankit Tiwari Aug 19 '22 at 12:01
-
And if your html content is safe *(it's generated by you only & don't render any anonymous javascript)* then you can **[`innerHTML`](https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML)** to render html – Ankit Tiwari Aug 19 '22 at 12:04
-
Thank you but I hasn't gotten my answer completely yet.Because my html content also include img tags.How can I do with that? – Ali GhiasvandMohammadkhani Aug 19 '22 at 12:05
-
You can use **innerHTML** to render any kind of **HTML** or **XML** markup so if you pass **img** tag it will render that here is one [example](https://stackoverflow.com/a/36859260/14457833) of rendering img using **innerHTML** – Ankit Tiwari Aug 19 '22 at 12:10
-
Thank you, I have got the answer of that.But by the way I have also edited my question and wrote another question. I will to give a guidance if you have any knowledge about that. – Ali GhiasvandMohammadkhani Aug 19 '22 at 12:28
-
Provide some code examples so it'll be easy for us to reproduce your problem – Ankit Tiwari Aug 19 '22 at 19:38