jquery not working on some forms

  • Posts: 8
  • Thank you received: 0
4 years 6 months ago #321044

-- HikaShop version -- : 4.3.0
-- Joomla version -- : 3.9.19
-- PHP version -- : 7.2.27
-- Browser(s) name and version -- : Chrome 83.0.4103.106 (Official Build) (64-bit)

Hello
using Joomla 3.9.19 and Hikashop Starter 4.3.0

I need to add pieces of jquery to address forms (e.g. in order to change background-color of firstname inputbox when focused), but sometimes - e.g.when openining the form via Usercontrol panel - it seems not to be possible, nothing happens.
Does it depend on something concerning ajax? Is there a way to bypass the problem?
Thank you very much
Ruggero

Please Log in or Create an account to join the conversation.

  • Posts: 83024
  • Thank you received: 13403
  • MODERATOR
4 years 6 months ago #321081

Hi,

That's probably because if you add your javascript code to the form view file it is not being processed when the interface is being loaded in AJAX. I suppose because you have your code wrapped in jquery.ready ( learn.jquery.com/using-jquery-core/document-ready/ ) which isn't called when the JS is run after the AJAX.
If you edit the file address / listing.php via the menu Display>Views, you'll see many times the line:

t.loading(false);
In each places, you can call your own code after the interface is being refreshed in AJAX.

Please Log in or Create an account to join the conversation.

  • Posts: 8
  • Thank you received: 0
4 years 6 months ago #321103

Thank you for your prompt reply, Nicolas.
I took a look to listing.php and sow, but sorry I'm not so handy with ajax: would you give me a little example? Something like a js alert when clicking on firstname textbox or something similar?
Thanks so much

Please Log in or Create an account to join the conversation.

  • Posts: 8
  • Thank you received: 0
4 years 6 months ago #321104

I mean also: where have I to put the code?

Please Log in or Create an account to join the conversation.

  • Posts: 83024
  • Thank you received: 13403
  • MODERATOR
4 years 6 months ago #321135

Hi,

Just put alert('test1'); and alert('test 2'); etc after each t.loading(false); and you'll see see where you need to add your javascript code based on which alert is displayed when you're on the area with the issue you have.

Please Log in or Create an account to join the conversation.

  • Posts: 8
  • Thank you received: 0
4 years 6 months ago #321167

Got it! Thank you Nicolas, I'm very grateful.
ruggero

Please Log in or Create an account to join the conversation.

Time to create page: 0.057 seconds
Powered by Kunena Forum