The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript add a javascript variable as a class

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #43118

    Hi Guys,

    I am working on a site where I want to query the location and then pass that as a class to a UL.

    The location API I am using returns the variable I want as geoplugin_countryCode()

    and the moment I am just hardcoding it in:



      What I would like to do is something like this:

      That doesn’t seem to work, but not sure what I am doing wrong?

      Thanks for any help.


    Thanks Guys,

    I will whip up a codepen.



    Going towards what srig99 was saying, what kind of data type does that function return? You may have to parse it before adding it.

    I took a look at that geoplugin, and im wondering… Do you have to set your own values for each function? I brought up the file and all the functions are blank? I don’t dabble with geolocation though so maybe im wrong.

    Am i missing something?

    function geoplugin_request() { return '';}
    function geoplugin_status() { return '403';}
    function geoplugin_city() { return '';}
    function geoplugin_region() { return '';}
    function geoplugin_regionCode() { return '';}
    function geoplugin_regionName() { return '';}
    function geoplugin_areaCode() { return '';}
    function geoplugin_dmaCode() { return '';}
    function geoplugin_countryCode() { return '';}
    function geoplugin_countryName() { return '';}
    function geoplugin_continentCode() { return '';}
    function geoplugin_latitude() { return '';}
    function geoplugin_longitude() { return '';}
    function geoplugin_currencyCode() { return '';}
    function geoplugin_currencySymbol() { return '';}
    function geoplugin_currencySymbol_UTF8() { return '';}
    function geoplugin_currencyConverter(amt, symbol) { return false; }
Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.