I have a link,
<a href="manager_view.html">
<p class="in_row">Jane Doe</p>
</a>
I want to show a checkmark, ✓, when Jane Doe has been clicked in the past. How would I do that?
JAVASCRIPT
document.getElementsByClassName('in_row')[0].onclick = function()
{
this.className = 'in_row clicked';
}
Or, if you have more than one:
var rows = document.getElementsByClassName('in_row');
for (var i = 0, len = rows.length; i < len; i++)
{
rows[i].onclick = doclick; //this function is the above code
}
CSS
.clicked:before
{
content:"✓";
}
You should use local storage http://www.w3schools.com/html/html5_webstorage.asp If you have more elements to store in it you can use JSON.stringify
When you create a array of clicked elements you store it like this
localStorage["rowsclick"] = JSON.stringify(elementsClickedArray);
And than to read that you need
elementsClickedArray = JSON.parse(localStorage["rowsclick"]);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.