1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Javascript Variable

Discussion in 'JavaScript' started by dean5000v, Apr 15, 2009.

  1. #1
    Hey well i have this code to get the correct position:

    $(document).ready(function(){

    var relativePosition = getRelativePosition("#Company_Name");

    var Test = (relativePosition);
    }



    but now i want to pass these values into a hidden field so i can then pass the values to php how would i go about storing the test var value into a field.
     
    dean5000v, Apr 15, 2009 IP
  2. jqueryHowto

    jqueryHowto Guest

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Something like this:

    getElementById("yourHiddenElementId").value="somevalue";
     
    jqueryHowto, Apr 15, 2009 IP
  3. dean5000v

    dean5000v Peon

    Messages:
    201
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    $("#x").val(Tests); is what i used !
     
    dean5000v, Apr 15, 2009 IP
  4. jqueryHowto

    jqueryHowto Guest

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    What is "Tests". Is a variable with string in it ?!

    If you are literally want to put string "Tests" into an element with ID x then you should add quotes around "Tests" like this:

    $("#x").val("Tests");
    Code (markup):
     
    jqueryHowto, Apr 16, 2009 IP