Use the same datalist for multiple pages

0

I'm trying to make a system where I would have a datalist with all my options and every page of my site would be mirrored. Example:

<input type="text" name="tCid" id="cCid" placeholder="Insira uma opção" list="cEst" />
<datalist id="cEst">
    <optgroup label="Séries Ativas">
        <option disabled>Opcao1</option>
        <option disabled>Opcao2</option>
        <option value="Opcao3">Opcao3</option>
        <option disabled>opcao4</option>
        <option disabled>Opcao5</option>
    </optgroup>
</datalist>

In this case, it will have a input for the user to type an option and select it. I just want this datalist to be unique to every page of my site. That is, when I take out disabled from Opcao1 and put value="Opcao1" , it should update all pages of my site that have this datalist tag.

    
asked by anonymous 17.07.2017 / 04:22

1 answer

0

For those who want to know, I did the following:
I put in a .txt file all the lines of code I wanted to mirror on every page. Then I used the following script to make it happen:

<script>
document.getElementById("cCid").onchange=function(){ 
    //this.value tem o valor que foi escolhido nas opções
    window.location.href = "https://www.site.com/series/" + this.value + "/index.html"; 
}</script>


Basically, I did the script add the whole .txt file in place of the this.value code, doing what PHP would make it much easier, but did not want to do with PHP. I hope I have helped someone

    
15.10.2017 / 03:37