I cant add my html code

  • Unknown's avatar

    I tried to add my html code to make two dependent on each other drop-down lists but it doesnt work at all. i trie this code on wix-designer and it works properly there

    The blog I need help with is: (visible only to logged in users)

  • Hi there,

    For security reasons only the following HTML tags are allowed on WordPress.com:
    https://en.support.wordpress.com/code/#html-tags

    If you want you can paste your HTML code here so I can double-check it.

  • Unknown's avatar

    <form id=”formID” action=”somewhere.php” method=”post”>

    <select name=”select1″ onchange=”aktualka(this);”>
    <option value=””>–Wybierz–</option>
    <option value=”o1″>o1</option>
    <option value=”o2″>o2</option>
    </select>

    <select name=”select2″ id=”select2″>
    <option value=””>–Wybierz–</option>
    </select>

    </form>

    <script type=”text/javascript”>
    var opcje_dla_1 = new Array (“Opcja dla 1 nr 1″,”Opcja dla 1 nr 2”);
    var opcje_dla_2 = new Array (“Opcja dla 2 nr 1″,”Opcja dla 2 nr 2”);
    var v_alue_dla_1= new Array (“o11″,”o12”);
    var v_alue_dla_2= new Array (“o21″,”o22”);

    function aktualka(obj){

    var what = obj.value;
    var select2 = document.getElementById(‘select2’);

    var dlugosc_dla_1 = opcje_dla_1.length-1;
    var dlugosc_dla_2 = opcje_dla_1.length-1;

    if(what == “o1”){

    select2.options.length = dlugosc_dla_1.length;
    for(var i=0;i<=dlugosc_dla_1;i++){
    select2.options[i] = new Option(opcje_dla_1[i]);
    select2.options[i].value = v_alue_dla_1[i];
    }

    } else if(what == “o2”){

    select2.options.length = dlugosc_dla_2.length;
    for(var i=0;i<=dlugosc_dla_2;i++){
    select2.options[i] = new Option(opcje_dla_2[i]);
    select2.options[i].value = v_alue_dla_2[i];

    }

    } else {
    select2.options.length = 1;
    select2.options[0] = new Option(“–Wybierz–“);
    select2.options[0].value = “”;
    }

    }
    </script>

  • This is Javascript and it’s not allowed on WordPress.com:

    Add Code to Your Site

  • Unknown's avatar

    so without java things i wrote that but i still cant see anything on my front page.
    <select name=”category” id=”category”>
    <option value=””>Miasto:</option>
    <option value=”1″>Stalowa Wola</option>
    <option value=”2″>Warszawa</option>
    <option value=”3″>Sandomierz</option>
    <option value=”4″>Nisko</option>
    <option value=”5″>Rzeszó w</option>

    </select>
    <select name=”sub_category” id=”sub_category”>
    <option value=””>Miejsce:</option>
    <option value=”miejsce”>Sklep spożywczy</option>
    <option value=”miejsce”> Siłownia</option>
    <option value=”miejsce”>Fryzjer</option>
    </select>

    <input type=”submit” value=”Szukaj” />
    </select>

  • It still contains tags that don’t work on WordPress.com. Can you tell what kind of drop-down you want to create, it might be available.

  • Unknown's avatar

    i want to create the first drop-down which will contain the name of cities and second drop-down list with locations in the city like cinema, hairdresser etc

  • Unknown's avatar

    second drop-down lists have to be dependent on the second drop-down list

  • Unfortunately, that’s not possible on WordPress.com. Using the self-hosted version of WordPress (WordPress.org) might suit your needs best.

  • The topic ‘I cant add my html code’ is closed to new replies.