- This topic is empty.
-
AuthorPosts
-
August 18, 2008 at 5:12 pm #23106rayishuMember
I have a page in wordpress, im putting all my html in that page using the wordpress editor
i have included my own JS in the headerNONE OF MY JQUERY SCRIPTS WORK IN WORDPRESS I DONT KNOW WHY
here is the page http://khaledstudios.com/?page_id=11
all there is, is a link there that says click me
and here is the JS
Code:$(document).ready(function() {
$(‘a’).click(functino(event) {
$(this).preventDefault();
alert(‘abc’);
});
});this sould work i dont know why it isnt.
August 19, 2008 at 12:11 am #49331rayishuMembersrry i fixed that, i wrote that script just for a quick demonstration purpose. i fixed the problem and i still get the problem. ….
August 19, 2008 at 2:26 pm #49286rayishuMemberok i figured it out. in wordpress instead of using $() notation you have to use jQuery();
thx for your guys helpFebruary 14, 2010 at 3:47 pm #70909Steven GardnerParticipantI am having similar problems. I am trying to create a simple jquery accordion effect for a gym class timetable.
I have addedCode:To the Header.php
and linked to my script just underCode:with
Code:Like Chris mentions in his WordPress book!
Here is the jquery file
Code:function initMenus() {
$(‘ul.menu ul’).hide();
$.each($(‘ul.menu’), function(){
$(‘#’ + this.id + ‘.expandfirst ul:first’).show();
});
$(‘ul.menu li a’).click(
function() {
var checkElement = $(this).next();
var parent = this.parentNode.parentNode.id;if($(‘#’ + parent).hasClass(‘noaccordion’)) {
$(this).next().slideToggle(‘normal’);
return false;
}
if((checkElement.is(‘ul’)) && (checkElement.is(‘:visible’))) {
if($(‘#’ + parent).hasClass(‘collapsible’)) {
$(‘#’ + parent + ‘ ul:visible’).slideUp(‘normal’);
}
return false;
}
if((checkElement.is(‘ul’)) && (!checkElement.is(‘:visible’))) {
$(‘#’ + parent + ‘ ul:visible’).slideUp(‘normal’);
checkElement.slideDown(‘normal’);
return false;
}
}
);
}
$(document).ready(function() {initMenus();});yet when i addd the html code in the page when i preview it there is no jquery in motion.
Does anyone have an idea of where i am going wrong?
This is my first attempt at adding jquery in wordpress without using a wordpress plugin.
Just noticed this thread is in the CSS Section. Not sure why!February 15, 2010 at 7:39 am #70944Steven GardnerParticipantFound out else where that i need to replace
Code:$with
Code:jQueryfor this script to work in wordpress.
Thanks
-
AuthorPosts
- The forum ‘CSS’ is closed to new topics and replies.