Author Topic: Joomla 4 and jQuery 3 .attr("checked") method  (Read 954 times)

ssc3

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 162
    • Online Store Plugins
Joomla 4 and jQuery 3 .attr("checked") method
« on: November 14, 2021, 18:01:13 pm »
In the checkout page

Code: [Select]
if($(this).attr("checked")){
is used in the checkout to determine if required elements such as "Terms and Conditions" are checked.
It helps to determine if the checkout task should be set to "confirm" and submit button to "Confirm Purchase"
In Joomla 4 jQuery 3.6 this value does not change when the check box is checked.
Instead it returns the original default status of the checkbox.
Suggest replacing with

Code: [Select]
if($(this).prop("checked")){
in view.html.php

to determine the current state of the checkbox. This also backwards compatible with Joomla 3

ssc3

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 162
    • Online Store Plugins
Re: Joomla 4 and jQuery 3 .attr("checked") method
« Reply #1 on: May 07, 2022, 13:38:30 pm »
Still a problem with VirtueMart 4.0.0 10645

To avoid the

"Checkout done, please confirm the order"

error message after ticking "Terms of Service" and checking out, replace in view.html.php

Code: [Select]
if($(this).attr("checked")){
by

Code: [Select]
if($(this).prop("checked")){
The former no longer works correctly Joomla 4 jQuery 3.6 when counting the number of required fields.


Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10213
  • VM3.9 Eagle Owl
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Joomla 4 and jQuery 3 .attr("checked") method
« Reply #2 on: May 07, 2022, 23:29:45 pm »
I am sorry, I did not see your post. Should work also in j3, I did a simple test, seem to works, thanks.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/