我正在尝试编写一些 javascript,当用户单击相应的文本时,它将返回 toasty.png 和 bready.png 的值。我可以返回“Toast”和“bread”,但不能返回其他文本。有什么建议吗?
<script>
$(document).on('vclick', '.changePageButton', function() {
console.log(this.text);
//console.log(value within the image)
});
</script>
<a class="changePageButton" value="Toast" data-transition="slide">
<input type = "hidden" name = "image" value = "toasty.png">
<input type = "hidden" name = "video" value = "video1.mpg">
test
</a>
<a class="changePageButton" value="bread" data-transition="slide">
<input type = "hidden" name = "image" value = "bready.png">
<input type = "hidden" name = "video" value = "video2.mpg">
test
</a>