javascript - JQuery click a state becomes active after submit it's not active -


i have svg map. when clicks on state say, "california" state turns yellow , form appears. working fine. code turns state yellow when clicked. code in head.

$("#map > svg > path").each(function(i){ $(this).css('fill', ''); }); $('#' + data.name).css('fill', '#e8f600'); 

after form submitted, if validation sees problem, go same page. state active turns #fff instead of staying #e8f600.

forgot add - i've been trying work no luck.

<?php if ($_post) { ?>   $('#' + data.name).css('fill', '#e8f600');   <?php echo ('#e8f600'); ?>     <?php } else { ?>     <?php echo ('#fff'); ?>       <?php }  ?>  

i've been trying find solution hours can't seem fix it.

my question,

how can code keep state active after posting on same page?


Comments

Popular posts from this blog

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

node.js - Using Node without global install -

java - JavaScript + Thymeleaf - select onchange -