jQuery to jScript

Hi Guys,
I know nothing about scripting but I need this script to be converted to JQuery or if jquery then to convert to jscript. Why? The script is not working in my wordpress theme.

In other words I need this script in the other format.

script here

https://jsfiddle.net/twtzbo1v/

I hope it’s convertible, or I understsnd things right.
Thank you

JQuery is already JScript. That your fiddle doesn’t work is due to the missing jQuery dependency.

Links: https://en.wikipedia.org/wiki/JQuery, https://en.wikipedia.org/wiki/JScript

Hi Dormilich
Missing Query dependency means?

Did you read somewhere or did somebody tell you somewhere that you needed to convert it? Both JavaScript and the JQuery library work with WordPress, but they need to be handled properly. For example, if the script is in an independent file, was it enqueued properly in the functions.php?

And if it is JQuery, are you taking into account that the version of JQuery that comes shipped with WordPress is in compatibility mode, so that it doesn’t conflict with other JavaScript libraries that might be used. This means that instead of using the $ shortcut, you need to use JQuery. For example, instead of $("#myID") you use jQuery("#myID").

2 Likes

Thank you sir, so if I get you the compatibility mode would you tell if this script compatible or not?

Hi,

I assume this has to do with what you PM’d me the other day - that you have a page, built using WP, and that there are JavaScript errors on that page, possibly caused by using a particular theme. I also assume that the page is still behind a login, meaning that you cannot post a link to it.

If this is the case, why not follow my advice to make a Short, Self Contained, Correct (Compilable), Example and post it here.

To do this, you should start with a blank HTML page, then go to the page you are having problems with and copy the source code (as it is generated by WordPress) into your blank page. If you have any problems with paths and/or includes, use the base URL element to point back to your domain. After that, start stripping out anything that is not relevant to your problem. When you have it down to the minimum, post back here.

P.S. One thing is for sure, converting from vanilla JS to jQuery will not solve your problem.

3 Likes

Hi Pullo how are you
I can do that, but I had 2 freelancers get in, and they tried for hours, the only way they got the form working by putting script in the footer, but then other pages stopped working… That’s why I assume that wherever this script is stopping the page to work…

Note: I’ve tried another simple script and works perfectly in my wordpress, so I guess 100% from the script

If anyone can rewrite the sccript in another way maybe helpful

Hmmm. Where did you find said freelancers? That doesn’t sound right to me…

I don’t think you’ll find anyone to help you, TBH. You say in post #1 that you know nothing about scripting, but yet you’re making random guesses about where the problem lies. And without any kind of code to go on (code which reproduces the error) you’ve got us shooting in the dark.

Good luck :slight_smile:

1 Like

I’m removing this whole script part from my form :smiley:

Thanks Pullo

Shame. Was it really that hard to make a page that reproduced your issue?

Anyway, your decision :slight_smile:

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.