Jquery inside onDisplayFieldValue () function

More
4 years 5 months ago #44297 by joomla_user
Hello,

On display field's value on front end i tried to use JQuery as i did in the back end's onDisplayField() function
but it seems it doesnt work.
On another hand, if i used Javascript directly it worked, i.e. :

NOT WORKING :
$js ="
      jQuery( document ).ready (function() {
  	   alert('test');
      }); 
  	";
$document->addScriptDeclaration($js);

DO WORK :
$js ="
      alert('test');
      ";
$document->addScriptDeclaration($js);

Question is how can i use JQuery ?
Thanks and best regards.

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

More
4 years 5 months ago #44298 by ggppdk
Hello

this code is not related to FLEXIcontent, it is a general Joomla and JS question

about your question
the first one should work if jQuery is loaded properly in your site

http://api.jquery.com/ready/


-- FLEXIcontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

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

More
4 years 5 months ago #44300 by joomla_user
Sorry for posting in wrong section !

I do see my code when view the page source, yet its not executed.
After my code i do see other JQuery code same as mine(only with other logic inside)...

what else it could be ?

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

More
4 years 5 months ago #44317 by ggppdk
Hello

-- check that jquery is loaded once
(you may use a joomla plugin that checks page's HTML replace multiple loading with a single one e.g. jQueryEasy),

-- check if you have any JS errors in your page


-- FLEXIcontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

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

More
4 years 5 months ago #44325 by joomla_user
Hi
Thank you for your fast reply,

What i needed is just to make sure its suppose to work, for a momnent i thought it is the way FC handles JQuery inside this function, but if not, and it suppose to work, then i'll look elsewhere.

Best regards.

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

More
4 years 5 months ago #44332 by ggppdk
Hello

yes it is supposed to work

if only the code without jQuery works,

then probably the loading of jQuery is broken or you have some other JS error in your page,

please that jQuery is loaded once and also check if you have any other JS errors


-- FLEXIcontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

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

Moderators: vistamediajoomlacornerggppdk
© 2018 Flexicontent. All Rights Reserved.