manix Posted October 11, 2011 Share Posted October 11, 2011 Heya I need to call a function in straight text just like that and I seem to be having trouble managin in Jquery.. Here's an example $(document).ready(function(){ function MyFunc() { stuff stuff } if(somecondition){call function here) }); how do I do that? Quote Link to comment https://forums.phpfreaks.com/topic/248913-jquery-calling-function/ Share on other sites More sharing options...
AyKay47 Posted October 11, 2011 Share Posted October 11, 2011 can we see it in the context of your code please. Quote Link to comment https://forums.phpfreaks.com/topic/248913-jquery-calling-function/#findComment-1278332 Share on other sites More sharing options...
manix Posted October 11, 2011 Author Share Posted October 11, 2011 var CurPic = 1; function Previous(){ CurPic--; if (CurPic==0) {CurPic=5;} $("#picslot").attr("src", CurPic+".jpg"); } function Next(){ CurPic++; if (CurPic==6) {CurPic=1;} $("#picslot").attr("src", CurPic+".jpg"); } $("#larrow").click(Previous); $("#rarrow").click(Next); $("body").bind('keydown',function(e) { var keypressed = e.which switch(keypressed) { case 37: Previous; break; case 39: Next; break; } }); this is a picture slider kind of thingy ... Quote Link to comment https://forums.phpfreaks.com/topic/248913-jquery-calling-function/#findComment-1278335 Share on other sites More sharing options...
manix Posted October 11, 2011 Author Share Posted October 11, 2011 As stupid as I could be, () solves it.. Quote Link to comment https://forums.phpfreaks.com/topic/248913-jquery-calling-function/#findComment-1278342 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.