کمک در یک کد جاوا اسکریپت سه خطی
سلام دوستان حرفه ای من . من یک کد میخوام بنویسم که مقدار داخل span رو بگیره و داخل لینکی قرار بده و مقدار خروجی اون لینک رو رو چاپ کنه ممنون میشم کمکم کنید
<td id="address" class="address"><span data-show-qr>1NDyJtNTjmwk5xPNhjgAMu4HDHigtobu1s</span> </td>
که مقدار داخل تگ span در حال حاظر 1NDyJtNTjmwk5xPNhjgAMu4HDHigtobu1s است . حال این مقدار به جای address داخل لینک زیر قرار بگیرد
var url="https://blockchain.info/q/addressbalance/"+address;
که عدد خروجی که در مرورگر نمایش داده میشود را در صفحه چاپ و نمایش دهد . فقط جهت مشاهده خروجی در مرورگر آدرس فیلتر است
https://blockchain.info/q/addressbal...Mu4HDHigtobu1s
ممنون میشم این کد رو برام بنویسید . من آشنایی زیادی به جاوا اسکریپت ندارم . واقعا سپاسگذارتونم
نقل قول: کمک در یک کد جاوا اسکریپت سه خطی
درود
کد مورد نظر شما به این شکله
HTML
کد HTML:
<td id="address" class="address"><span data-show-qr>1NDyJtNTjmwk5xPNhjgAMu4HDHigtobu1s</span> </td><div id="res"></div><script src="https://cdnjs.cloudflare.com/ajax/libs/axios/0.18.0/axios.min.js"></script>
JS
const address = document.querySelector("span[data-show-qr]").innerHTML;
const url = "https://blockchain.info/q/addressbalance/" + address;
axios.get(url).then(function(res) {
document.querySelector("#res").innerHTML = res.data;
});