Welcome Guest ( Log In | Register )

Outline · [ Standard ] · Linear+

 jQuery

views
     
TSmumeichan
post Oct 30 2009, 09:27 PM, updated 17y ago

Member
*******
Senior Member
4,152 posts

Joined: May 2005
I cant seem to get jQuery to work. I've read all kinds of tutorials on the net and used some simple examples but no matter what, the codes dont seem to work. They dont work is Dreamweaver's Live View nor do they load in FF 3.5. Is there something I have to install to get jQuery to work? Is my code simply wrong?

Here is the code I tried out
CODE
<script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.js">
<script type="text/javascript">
       $(function() {
  S(."normalname") .text() .clone(). prependTo("p100");
  });
</script>


I've added "p100" on my own and that shows up fine.

I noticed that the .text() and.clone() is fade when I input them in Dreamweaver

This post has been edited by mumeichan: Oct 30 2009, 09:49 PM
TSmumeichan
post Oct 31 2009, 08:31 AM

Member
*******
Senior Member
4,152 posts

Joined: May 2005
Thanks, it works if I use it exactly as you wrote it.

However when i try it on some thread in lowyat, it doesn't work. I'm trying to see if I can collect all the usernames on a page and send them, to some paragraph right below.

This post has been edited by mumeichan: Oct 31 2009, 08:58 AM
TSmumeichan
post Oct 31 2009, 04:01 PM

Member
*******
Senior Member
4,152 posts

Joined: May 2005
QUOTE(sunsuron @ Oct 31 2009, 01:11 PM)
If you need web scraping script, it will require mo lines of codes. Why do you need to gather all the username?
*
Have you played epicmafia before? If you haven't, Epicmafia is a site at www.epicmafia.com that allows you to play 'mafia' online with other players from around the world.

In a mafia game, you will be assigned to a random role, say Cop and depending on certain choices you and other players make, you will get a 'report'.

I want to write a greasemonkey script that will

1. Gather the name of the other players playing with me and send them to a list/menu on the page which I can add on my own.
2. Create other dynamic content from the list of names.

Before two days ago, I knew nothing about web designing, html, css, java, ajax and whatnot. Since I do photoshop and got myself the who CS4 suite since I'm a student, I thought hey Dreamweaver is supposed to be pretty nifty, it can do anything and well after two days I realized this need some pretty tough javascript.

Using Firebug and DOM inspector, I have identified all the ids, classes and tags, xpaths of the data I need to pull using jquery. The problem is, I can't get jQuery to work on the page as I want it to. when I create a simple test page, the jQuery scripts work fine, but when I insert them into the page they do nothing.

Another problem is I can't use any server-side stuff like php, sql etc cause that would be hacking and cheating at the same time. It has to be strictly client-side.
TSmumeichan
post Nov 1 2009, 03:16 PM

Member
*******
Senior Member
4,152 posts

Joined: May 2005
Thanks alot for that script. I'm learning so much now.

Please help me with another question.

The class I want to call is "username rollhover" However if I were to write
CODE

$(".username rollhover")

, jQuery will look for the the tag "rollhover" that is a child of something with the class "username" right? So how to I ask jQuery to look for classes with spaces?

This post has been edited by mumeichan: Nov 1 2009, 03:17 PM
TSmumeichan
post Nov 2 2009, 09:02 PM

Member
*******
Senior Member
4,152 posts

Joined: May 2005
QUOTE(sunsuron @ Nov 1 2009, 08:54 PM)
Dealing with multiple class can be bit tricky but luckily jQuery provide the attr() function. We can find all the elements with specific classes with this function. Here is an example:

» Click to show Spoiler - click again to hide... «

*
Thanks alot for the script. I don't quite understand it fully yet but I'm trying too. I'm still reading up a book and javascript and jQuery each. However I'm particularly mystified by this line of code below
CODE
var collection = []


What does it mean when you declare a variable and set it's value to "[]", What do empty brackets represent or do?

 

Change to:
| Lo-Fi Version
0.0172sec    0.47    6 queries    GZIP Disabled
Time is now: 8th December 2025 - 07:08 AM