The date string in
li: 2018-10-12, etc., after many times, the values are all taken out with js and modified to: 2018-10 "strong" 12 "/ strong", and finally the modified results are rewritten into the corresponding original tag, so that I can use css control to do a design style. I can only patchwork so that I can modify it after onclick. I don"t know how to change it automatically without mouse trigger.
<ul id="news">
<li><p class="time">2018-10-12</li>
<li><p class="time">2017-08-03</li>
</ul>
<script>
//:replacePos(, , "");
function replacePos(strObj, pos, replacetext) {
var str = strObj.substr(0, pos-1) + replacetext + strObj.substring(pos, strObj.length);
return str;
}
//
function picnewsTime() {
var obj = $(".time");//JQclasstime
for(var i = 0; i < obj.length; iPP) {
(function(arg){
var txt = obj[arg].textContent || obj[arg].innerText;//
var newhtml = replacePos(txt, 8, "<strong>");//replacePos()"-" <strong>
newhtml += "</strong>";//</strong>
//onclick
obj[arg].onclick = function() {
$(this).html(newhtml);//
}
})(i);//i
}
}
picnewsTime();
</script>