Not able to display div with style.display='block';
i have a jsp with style as display : none i want to set display as block in javascript i have written below code but its not working also i have tried to set display in document.ready strangely it was working but after refreshing page 2 3 times. result here is loaded by making ajax call.
jsp code:
<c:set var="projVar" value="ssc-portal-2.0.3.x"/>
<div style="display: none;" id="<c:out value="${projVar}"/>">
</div>
javascript:
// result is : ssc-portal-2.0.3.x@/P_ssc@@SSC00004951@/P_ssc(WI- 1409);,
function populateActivityInfo(result) {
var resultProjArr = result.split(',');
var tempProjName = '';
var activityList = '';
var tempProj = '';
for (var i = 0; i < resultProjArr.length; i++) {
if (trim(resultProjArr[i]) != '') {;
tempProjName = resultProjArr[i].split('@@')[0];
activityList = resultProjArr[i].split('@@')[1];
tempProj = trim(tempProjName.split('@')[0]);
//here tempProj is ssc-portal-2.0.3.x
document.getElementById(tempProj).style.display = 'block';
}
}
}
You say the id is ssc-portal-2-0-3-x
//here tempProj is ssc-portal-2-0-3-x
document.getElementById(tempProj).style.display = 'block';
While the id should be ssc-portal-2.0.3.x
.
<c:set var="projVar" value="ssc-portal-2.0.3.x"/>
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.