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: "[email protected]", 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
    Commented Jul 5, 2019 at 11:12
  • i have already try with this but no luck Commented Jul 5, 2019 at 11:12
  • Is it working for you? Commented Jul 5, 2019 at 12:24
  • Happy to help !! Happy coding :) +1 from mine. Commented Jul 8, 2019 at 5:16

2 Answers 2

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: "[email protected]", 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 and acknowledge you have read our privacy policy.

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