jquery issues
Permalink
Hi
I decided to post my own issues as I could not find a suitable answer in the forum but happy to be directed to it!
I am using two jquery scripts to automate some functions on my pages (one creates links from header tags and the other is a FAQ toggle).
The problem is that on some pages these scripts work but not on others! Also when I log in and go into edit mode the scripts seem to work again until I refresh the page. Not all pages call both scripts but whether they work or not seems random.
I am relying on the in-built jquery which is called before my two scripts. I cannot explain the erratic behaviour.
Greatly appreciate your assistance!
I decided to post my own issues as I could not find a suitable answer in the forum but happy to be directed to it!
I am using two jquery scripts to automate some functions on my pages (one creates links from header tags and the other is a FAQ toggle).
The problem is that on some pages these scripts work but not on others! Also when I log in and go into edit mode the scripts seem to work again until I refresh the page. Not all pages call both scripts but whether they work or not seems random.
I am relying on the in-built jquery which is called before my two scripts. I cannot explain the erratic behaviour.
Greatly appreciate your assistance!
Thanks for your reply Scott. You are challenging my limited coding skills so I think it is best for me to include part of the header code where I call on these jquery functions. The weird thing is they work on some pages but not on others, so script appears to be called properly. I hope this extra info will clarify my query and allow you to diagnose.
Many thanks
C.
Many thanks
C.
I managed to fix it. It was a simple matter of calling the scripts in the js folder using correct URL notation. Scripts did not work in lower level pages as I used ../../script.js instead of /script.js. Now the js folder is accessible irrespective of page level.
C.
C.
You'll want to trigger the bind on something other than a document ready function, usually you can just simply do a function call
var nonCollidingObject = {
doFancyStuff:function(){
$('#wrapped-set').doSomethingCool();
}
}
then in your page simply have
<script type="text/javascript">
nonCollidingObject.doFancyStuff();
</script>
I don't know if that helps at all, but that's where I'd start looking at it. If you are firing on $(document).ready(function(){
});
that has already ran unless there is a page refresh.. though often it will still work for modal popups and things like that.