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

前端 未结 6 1604
[愿得一人]
[愿得一人] 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:42

    Javascript:

    var y = document.getElementById("test").innerText;
    

    jQuery:

    $("#test").text();
    

    To get the HTML:

    var html = document.getElementById("test" ).innerHTML;
    

    jQuery:

    $("#test").html();
    

提交回复
热议问题