I'm trying to add some custom jQuery to a page on my wordpress site.
I have used a plugin that allows me to insert my code directly in to my head.php file for the specific page but the code doesn't run, i just get the error
TypeError: $ is not a function
$(document).ready(function(){
I used jQuery(function ($) { ...
from an answer to this question: TypeError: $ is not a function when calling jQuery function
<script>
jQuery(function ($(document).ready(function(){
jQuery(function ($)("#a").mouseover(function(){
jQuery(function ($)("#b").css("background-image", "url('https://oxfordriderwear.com/wp-content/uploads/2019/07/straight-black-cropped.jpg')");
});
jQuery(function ($)("#a1").mouseover(function(){
jQuery(function ($)("#b").css("background-image", "url('https://oxfordriderwear.com/wp-content/uploads/2019/07/straight-blue-cropped.jpg')");
});
jQuery(function ($)("#a2").mouseover(function(){
jQuery(function ($)("#b").css("background-image", "url('https://oxfordriderwear.com/wp-content/uploads/2019/07/straight-wash-cropped.jpg')");
});
jQuery(function ($)("#slim-a").mouseover(function(){
jQuery(function ($)("#slim-b").css("background-image", "url('https://oxfordriderwear.com/wp-content/uploads/2019/07/black-slim-rollover-cropped.jpg')");
});
jQuery(function ($)("#slim-a1").mouseover(function(){
jQuery(function ($)("#slim-b").css("background-image", "url('https://oxfordriderwear.com/wp-content/uploads/2019/07/blue-slim-rollover-cropped.jpg')");
});
jQuery(function ($)("#slim-a2").mouseover(function(){
jQuery(function ($)("#slim-b").css("background-image", "url('https://oxfordriderwear.com/wp-content/uploads/2019/07/blue-washed-slim-rollover-cropped.jpg')");
});
});
</script>
I think I'm getting my syntax wrong but I'm not sure where.
I also tried linking jQuery in the code via CDN, but this stopped the other jQuery elements on my page working that are from plugins, such as my navigation bar.
If anyone knows what I'm doing wrong and how to get around this issue, i'd greatly appreciate the help!