1

I am binding knockout js value to html but it's give me

[object HTMLLIElement]

insteadof value

  prescriptionList:{customer_prescription_id: "1", customer_id: "23971", customer_name: "Rutvee Sojitra", customer_email: "rutvee.sojitra@krishtechnolabs1.com", prescription: "This is some Description for this product option", …}
enter code here



     <td class="col col-method" data-bind ="foreach: prescriptionList()">
                            <span data-bind="text: prescription"></span>
4
  • Have you tried html instead of text <span data-bind="html: prescription"></span> ?
    – aravind
    Jul 5 '19 at 11:12
  • i have already try with this but no luck Jul 5 '19 at 11:12
  • Is it working for you? Jul 5 '19 at 12:24
  • Happy to help !! Happy coding :) +1 from mine. Jul 8 '19 at 5:16
1

Add this below code in your html :

<td class="col col-method">
<!-- ko foreach: prescriptionList -->
    <span data-bind="text: prescription"></span>
<!-- /ko -->
</td>

Make sure that your array length should be available.

Refresh your html file in a browser and check the output.

0

Try this,without foreach

prescriptionList:{customer_prescription_id: "1", customer_id: "23971", customer_name: "Rutvee Sojitra", customer_email: "rutvee.sojitra@krishtechnolabs1.com", prescription: "This is some Description for this product option", …}
enter code here

<td class="col col-method">
<span data-bind="text:prescriptionList().prescription"></span>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.