Welcome Guest [Log In] [Register]
Search Members Calendar | Rules ZB Code Index IF Code Index
ZBCode
  • Navigation
  • ZBCode
  • Coding Support
  • Code University
  • If statement with jquery
Hey, welcome to ZBCode, the premier coding forum for ZB. Here you fill find some of the best Invisionfree and Zetaboards Codes on the network! Unfortunately, you're sorta hovering around in guest mode at the moment; why not join in on the fun? Register an account and you can start accessing the wealth of resources we have available here. Enjoy your stay at ZBCode, and remember to tell all your friends about us; the more members, the more codes available. ;)

Interested in joining? Click here.


If you are already a member of ZBCode, feel free to login right here:

Username:   Password:
Add Reply
If statement with jquery
Topic Started: Nov 21 2009, 09:24 AM (95 Views)
Swordslam46 Nov 21 2009, 09:24 AM Post #1
Member Avatar
SwoЯdslam46

Posts:
933
Group:
Dedicated
Member
#2,773
Joined:
Apr 9, 2009
So I am still trying to get good at JS (the sites I am using only go so far) so I am now resorting to asking questions.

How would I do an if statement using jquery?

would it be

if $("top_info strong=="Swordslam46")
{
alert("Welcome back")
}


or would it be somethng else?
Click Me!!!
Offline Profile Quote Post Goto Top
 
Gorgor Nov 21 2009, 09:36 AM Post #2
Hello

Posts:
1,182
Group:
Coding Staff
Member
#2,728
Joined:
Apr 2, 2009
Coding language
PHP
if($("top_info strong=="Swordslam46"))
{
alert("Welcome back")
}
This forum is closed. Please visit http://zetascript.co.cc
This forum is closed. Please visit http://zetascript.co.cc
This forum is closed. Please visit http://zetascript.co.cc
This forum is closed. Please visit http://zetascript.co.cc
This forum is closed. Please visit http://zetascript.co.cc
This forum is closed. Please visit http://zetascript.co.cc
This forum is closed. Please visit http://zetascript.co.cc
This forum is closed. Please visit http://zetascript.co.cc
This forum is closed. Please visit http://zetascript.co.cc
This forum is closed. Please visit http://zetascript.co.cc
This forum is closed. Please visit http://zetascript.co.cc
This forum is closed. Please visit http://zetascript.co.cc
This forum is closed. Please visit http://zetascript.co.cc
This forum is closed. Please visit http://zetascript.co.cc
This forum is closed. Please visit http://zetascript.co.cc
This forum is closed. Please visit http://zetascript.co.cc
This forum is closed. Please visit http://zetascript.co.cc
This forum is closed. Please visit http://zetascript.co.cc
Offline Profile Quote Post Goto Top
 
Swordslam46 Nov 21 2009, 09:46 AM Post #3
Member Avatar
SwoЯdslam46

Posts:
933
Group:
Dedicated
Member
#2,773
Joined:
Apr 9, 2009
doesnt seem to work, I put top_info because top_info strong isnt an ID, I also put it above the board, should I put it in JS instead?
Click Me!!!
Offline Profile Quote Post Goto Top
 
Choco Nov 21 2009, 11:34 AM Post #4
Member Avatar
¡ʎɹoʇɔɐɟ ʎʇıʌɐɹƃ ɐ uı pǝddɐɹʇ ɯ,ı 'dןǝɥ

Posts:
589
Group:
Admins
Member
#3,272
Joined:
Jun 30, 2009
Coding language
Everything
Are you trying to check if a specific user is logged in? Then do this:
Code:
 
if($("#top_info strong").text() == "Swordslam46") {
alert("hai.");
}
Posted ImageIt's a magical world, Hobbes, ol'd buddy... ...let's go exploring!
In progress: Something Special ;)
Offline Profile Quote Post Goto Top
 
Gorgor Nov 21 2009, 02:09 PM Post #5
Hello

Posts:
1,182
Group:
Coding Staff
Member
#2,728
Joined:
Apr 2, 2009
Coding language
PHP
Do what Choco said.

All I noticed was that there wasn't a ( before the $. I didn't really look at the code :P
This forum is closed. Please visit http://zetascript.co.cc
This forum is closed. Please visit http://zetascript.co.cc
This forum is closed. Please visit http://zetascript.co.cc
This forum is closed. Please visit http://zetascript.co.cc
This forum is closed. Please visit http://zetascript.co.cc
This forum is closed. Please visit http://zetascript.co.cc
This forum is closed. Please visit http://zetascript.co.cc
This forum is closed. Please visit http://zetascript.co.cc
This forum is closed. Please visit http://zetascript.co.cc
This forum is closed. Please visit http://zetascript.co.cc
This forum is closed. Please visit http://zetascript.co.cc
This forum is closed. Please visit http://zetascript.co.cc
This forum is closed. Please visit http://zetascript.co.cc
This forum is closed. Please visit http://zetascript.co.cc
This forum is closed. Please visit http://zetascript.co.cc
This forum is closed. Please visit http://zetascript.co.cc
This forum is closed. Please visit http://zetascript.co.cc
This forum is closed. Please visit http://zetascript.co.cc
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Code University · Next Topic »
Add Reply

Track Topic · E-mail Topic Time: 5:23 PM Sep 3
Hosted for free by ZetaBoards