javascript - PHP - How I can get innerHTML on an element? -
i novice in php. have javascript functions adding , removing , moving favorites (dom manipulation only). when refresh page favorites cleared. need:
1.get innerhtml on current (dom manipulated) favorites div element (where favorites are).
2.store html in php varable (i need 'php' varable cuz insert value in db).
favorite div 1 favorite created :
<div id="favorites"> <div id="1" class="favorite"> <sub class="minid">id 1</sub> <a href="http://www.zamunda.net">zamunda.net</a> <span onclick="movefavorite(1)"> <img class="move" src="icon/move.png" title="move"> </span> <span onclick="removefavorite(1)"> <img class="delete" src="icon/del.png" title="delete"> </span> </div> </div>
js:
var v = document.getelementsbyclassname('minid')[0].innerhtml; // select whatever $.cookie("something", v, { expires: 5 }); // set cookie
php:
<?php echo $_cookie['something']; /* ... */ ?>
Comments
Post a Comment