jquery - Why doesn't my cookie show in input field when set? -


i have cookie function setting cookie in input field, , button save it. when save , refresh page input field empty again.

note: have jquery dialog , sticky navigation bar. maybe overrides other jquery code somehow.

my jquery code set cookie:

//set cookie voor de postcode $(function() {     $('#go').click(function(){         $.cookie('postcode', $('#postcode').val());             });      //retrieve cookie on load if it's not undefined     if(typeof $.cookie('postcode') !== 'undefined'){         $('#postcode').val($.cookie('postcode'));     } }); 

my function set cookie in input.

    <div id="searchbox">         <div id="search">         <fieldset>         <legend><h2>zoeken in uw regio:</h2></legend>         <form action="<?= base_url('home/zoekresultaten') ?>">         <p class="field"><label class="field" for="naam">geef een zoekterm op:</label><input type="search" value="" name="postocde" /></p>         <br />         <p class="field"><label class="field" for="naam">kies hier een categorie:</label><select>           <option value="0" disabled selected>alle categorieën...  </option>           <option value="1">categorie1</option>           <option value="2">categorie2</option>           <option value="3">categorie3</option>         </select>         </p>  //my code set cookie          <p class="field"><label class="field" for="naam">vul hier uw postcode in:</label><input type="text" id="go" value="" name="search"/></p>  // end of ocde          <br />         <p class="field"><label class="field" for="naam">kies een afstand:</label><select>           <option value="0" disabled selected>afstand...</option>           <option value="1">5km</option>           <option value="2">10km</option>           <option value="3">15km</option>           <option value="4">20km</option>           <option value="5">25km</option>         </select>         </p>         <br />         <input type="submit" id="go" class="searchbutton" value="zoek" />         </form>         </fieldset>         </div> 

i don't know why isn't working. cookie hiding dialog working fine cookie.js file loaded well.

thanks.

it important note after setting cookie have reload page working of cookie. set cookie , destroy cookie work after reload page @ least once after setting , destroying cookie.


Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -