Is it possible to get the value of a element using onclick?

前端 未结 6 1600
[愿得一人]
[愿得一人] 2020-12-22 07:51

I currently have a table that has a list of email template names being echoed using php. Below is part of the php code. I\'m trying to grab the table value and pass it to

6条回答
  •  轮回少年
    2020-12-22 08:40

    With javascript:

    To get raw text without any elements or:

    somevar=document.getElementById ( "test" ).innerText;
    

    To get full html code of tag. Contents will be stored in 'somevar' variable.

    somevar=document.getElementById ( "test" ).innerHTML;
    

提交回复
热议问题