How to return value to console in javascript? -
i trying write javascript return value of toasty.png , bready.png when user clicks on respective text. i'm able return "toast" , "bread" not other text. advice?
<script> $(document).on('vclick', '.changepagebutton', function() { console.log(this.text); //console.log(value within 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>
// did mean "click"? $(document).on('click', '.changepagebutton', function () { var inputs = {}; console.log(this.text); $(this).children('input').each(function (v) { inputs[$(this).prop('name')] = $(this).val(); }); console.log(inputs); console.log(inputs.image); console.log(inputs.video); });
Comments
Post a Comment