私のhref値を変更しようとしていますが、変更されていないようです。私はjQueryとjavascriptの両方のメソッドを試してみましたが、どちらもうまくいきませんでした。タグのhref値を変更できません
<a type="button" class="view_me btn btn-primary" href="#">View Full</a>
$(document).on("click", ".click_row", function (e) {
e.preventDefault();
var _self = $(this);
userId = _self.data('id');
var newLink = '/users/view/' + userId //I'd like to eventually use this as new href link
$(".view_me").prop("href", "www.google.com"); // Tried testing with a simple webpage
// document.getElementById('view_test').href = "www.google.com"; // Tried this as well, doesn't work
console.log(newLink)
});
任意の提案が役立つだろう。私はjQueryを使用しています。3.2.1
'。代わりに 'http:// www.google.com'を試してください。 –
は' view_test'と 'click_row'です。 – guradio
' View Full 'はIDが' view_test'ではありません。 –