2

Magento CE 2.4.5 display "HTML tags must be properly nested and closed:" How to fixed on folllow code: enter image description here

JQMIGRATE: HTML tags must be properly nested and closed: <div if="isPaymentMethodsAvailable()"
     class="items payment-methods">
<div repeat="foreach: paymentGroupsList, item: '$group'"
         class="payment-group">
<!-- ko if: showFormShared($group) -->
<!-- ko foreach: getRegion('billing-address-form-shared') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
<!--/ko-->
<each args="data: getRegion($group().displayArea), as: 'method'" render=""/>
</div>
</div>
<div ifnot="isPaymentMethodsAvailable()"
     class="no-payments-block"
     translate="'No Payment Methods'">
</div>
JQMIGRATE: HTML tags must be properly nested and closed: <div class="order-comment-block">
<label class="label">
<span data-bind="i18n: 'Order comment'"></span>
</label>
<div class="control">
<textarea class="admin__control-textarea" data-bind="
            value: value,
            valueUpdate: valueUpdate,
            hasFocus: focused,
            attr: {
                name: inputName,
                cols: cols,
                rows: rows,
                'aria-describedby': noticeId,
                placeholder: placeholder,
                id: uid,
                disabled: disabled
            }"
                />
    </div>
</div>
0

1 Answer 1

10
  1. The fix for the first code:

It will be located somewhere like app/design/frontend/YourThemeVendor/YourTheme/Magento_Checkout/web/template/payment-methods/list.html

<div if="isPaymentMethodsAvailable()"
     class="items payment-methods">
     <div repeat="foreach: paymentGroupsList, item: '$group'"
              class="payment-group">
          <!-- ko if: showFormShared($group) -->
          <!-- ko foreach: getRegion('billing-address-form-shared') -->
          <!-- ko template: getTemplate() --><!-- /ko -->
          <!--/ko-->
          <!--/ko-->
     <each args="data: getRegion($group().displayArea), as: 'method'" render=""></each>
     </div>
</div>
<div ifnot="isPaymentMethodsAvailable()"
     class="no-payments-block"
     translate="'No Payment Methods'">
</div>

In the above code, I've added the close tag for each tag: <each args="data: getRegion($group().displayArea), as: 'method'" render=""></each>

  1. The fix for the second code:
<div class="order-comment-block">
     <label class="label">
          <span data-bind="i18n: 'Order comment'"></span>
     </label>
     <div class="control">
          <textarea class="admin__control-textarea" data-bind="
                      value: value,
                      valueUpdate: valueUpdate,
                      hasFocus: focused,
                      attr: {
                          name: inputName,
                          cols: cols,
                          rows: rows,
                          'aria-describedby': noticeId,
                          placeholder: placeholder,
                          id: uid,
                          disabled: disabled
                      }"
                          ></textarea>
    </div>
</div>

This code is from a custom module so I don't know where it locates, you can find the path for that file by running this command: grep -r "order-comment-block" app vendor.
In the above code, I've added the close tag for textarea tag: <textarea></textarea>

Conclusion: Since Magento 2.4.4, you have to make sure all *.html files have the correct open/close tags. Closing tags with /> is not allowed anymore.

3
  • Thanks @Tu Van, This worked like a charm! change all /> and make it proper ending <span /> to <span></span> <each ... /> to <each> </each> Dec 6, 2022 at 14:38
  • @ShyamRanpara Glad to hear that. Cheers
    – Tu Van
    Dec 6, 2022 at 16:03
  • 1
    This solution worked really well for me. Thanks @TuVan! Jan 20, 2023 at 17:23

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.