Jquery inside onDisplayFieldValue () function

More
10 years 2 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 :
Code:
$js =" jQuery( document ).ready (function() { alert('test'); }); "; $document->addScriptDeclaration($js);

DO WORK :
Code:
$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
10 years 2 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

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...

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

More
10 years 2 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
10 years 2 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...

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

More
10 years 2 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
10 years 2 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...

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

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.310 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline