#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Posts
    58
    Rep Power
    2

    Get the Element? Simple but i need help


    Hey,

    How do i get the element of an id in jQuery.

    Example...

    Code:
    <span id = "apple">Apple Goose</span>
    
    The jQuery Function will simply outprint (or alert) what's inbetween the tag. 
    
    So "Apple Goose" will be what's the function outputs.
    So how do i get the "Apple Goose" from 'apple'?
  2. #2
  3. A Not To Shabby Code Smurf
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Aug 2008
    Posts
    1,183
    Rep Power
    184
    Originally Posted by ide
    Hey,

    How do i get the element of an id in jQuery.

    Example...

    Code:
    <span id = "apple">Apple Goose</span>
    
    The jQuery Function will simply outprint (or alert) what's inbetween the tag. 
    
    So "Apple Goose" will be what's the function outputs.
    So how do i get the "Apple Goose" from 'apple'?
    Youi would do it like this:
    Code:
    $("#apple").text()
    or...
    Code:
    $("#apple").html()

IMN logo majestic logo threadwatch logo seochat tools logo