• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Added Javascript Not Working

Added Javascript Not Working 9 years 9 months ago #31775

  • Toad78
  • Toad78's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 27
So I've added the following Javascript:
<script type="text/javascript">
    $("document").ready(function() {
        $('#Total').before("$");
    });
</script>

This code should post a dollar sign ($) BEFORE the input textbox. It doesn't appear but has proven to work (based upon my tests elsewhere outside of RSFormsPro).


Anyone know why this code won't work inside of RSFormsPRO's Javascript box, but if I put this in my web template it does work?
The administrator has disabled public write access.

Added Javascript Not Working 9 years 9 months ago #31785

  • josh.thomson
  • josh.thomson's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 19
  • Thank you received: 2
Well firstly, that's not really Javascript... that looks like jQuery to me... so:

1. make sure the jQuery library is included in the <head> section of your joomla template.

2. Since Joomla is odd, you need to change the prefix from $ to jQuery.... so your code will look like this:

<script type="text/javascript">
jQuery("document").ready(function() {
jQuery('#Total').before("$");
alert("Josh is the Best!");
});
</script>

give that a go and let me know.
You could also add an alert which will make it clearer if the JS is working.
p.s. lol I couldn't help myself with the alert string haha.

Good Luck!
Last Edit: 9 years 9 months ago by josh.thomson. Reason: improved commenting
The administrator has disabled public write access.
The following user(s) said Thank You: Toad78

Added Javascript Not Working 9 years 9 months ago #31803

  • Toad78
  • Toad78's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 27
Still the same problem. I entered in your code in the CSS/Javascript box and it still doesn't work. Thank you for the tip, though.
The administrator has disabled public write access.

Added Javascript Not Working 9 years 9 months ago #31808

  • josh.thomson
  • josh.thomson's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 19
  • Thank you received: 2
Go to your template file and put it in the <head> section there... so instead of using Joomlas fancy GUI and entering it in one of the 'Add your JavaScript Here' boxes... try actually placing it in your template file...

Don't forget to also include jQuery!!!

Add this at the top of the previous code... eg:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script type="text/javascript">
jQuery("document").ready(function() {
alert("Josh is the Best!");
});
</script>

make sure that you have the include jQuery script link ABOVE the code otherwise it wont work. ...This is because the JavaScript is loaded from the top-down... making the position of linking the jQuery library crucial for it to work.

Good Luck!
Last Edit: 9 years 9 months ago by josh.thomson.
The administrator has disabled public write access.

Added Javascript Not Working 9 years 9 months ago #31813

  • cosmin.cristea
  • cosmin.cristea's Avatar
  • OFFLINE
  • Platinum Boarder
  • Posts: 756
  • Thank you received: 144
Can you provide a URL to your form so we can take a look ?

PS: loading jQuery should not be done in this manner.
My help is not official customer support. To receive your support, submit a ticket by clicking here
Last Edit: 9 years 9 months ago by cosmin.cristea.
The administrator has disabled public write access.

Added Javascript Not Working 9 years 9 months ago #31818

  • Toad78
  • Toad78's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 27
Yes, that's what I wound up doing. I always had jQuery loading. So this is how I left the code to work, manually entering into my template, which works:

<script type="text/javascript">
jQuery(document).ready(function() {
jQuery('#Total').before("<span class='totalnumber'>$</span>");
});
</script>
The administrator has disabled public write access.

Added Javascript Not Working 9 years 9 months ago #31837

  • josh.thomson
  • josh.thomson's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 19
  • Thank you received: 2
Ah ok, I'm glad you got it working :)
The administrator has disabled public write access.

Added Javascript Not Working 9 years 9 months ago #31848

  • Toad78
  • Toad78's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 27
But the question still remains as to why it doesn't work in RSFormsPro!
The administrator has disabled public write access.

Added Javascript Not Working 9 years 9 months ago #31851

  • cosmin.cristea
  • cosmin.cristea's Avatar
  • OFFLINE
  • Platinum Boarder
  • Posts: 756
  • Thank you received: 144
cosmin.cristea wrote:
Can you provide a URL to your form so we can take a look ?

PS: loading jQuery should not be done in this manner.
My help is not official customer support. To receive your support, submit a ticket by clicking here
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!