Java & jsp pass-through skills

1.JavaScript clear the textArea content

    document.getElementById(IdValue).value=null;

2.JavaScript set the attribute value for a tag (such as setting the placeholder content)

document.getElementById(IdValue).setAttribute('placeholder',"回" );

3.JavaScript Set the attribute value for the child node of a tag

document.getElementById("idName").firstElementChild.setAttribute('id',Id);`

4.Data access in JavaScript (sessionStorage)

  • Store:
sessionStorage.setItem("id","1");
  • 取:
 var id=sessionStorage.getItem("id");
  • delete:
sessionStorage.removeItem("id");