通常,我正在嘗試在 p、div 和 pre 標(biāo)簽中傳遞值,并且值顯示在上面的標(biāo)簽中,現(xiàn)在我正在輸入標(biāo)簽中傳遞國家/地區(qū)名稱。但輸入標(biāo)簽中不顯示值。這是我的代碼:<!DOCTYPE html><html><head> <title>Get browser and ip address </title></head><body><script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><h1><a href="https://ipdata.co">ipdata.co</a> - IP geolocation API</h1><input type="text" name="country_name" id="country_name" value=""><p id="country_name"></p><div id="ip"></div><div id="city"></div><pre id="response"></pre><script> $.get("https://api.ipdata.co?api-key=test", function (response) { $("#ip").html("IP: " + response.ip); $("#city").html(response.country_name + ", " + response.region); $("#country_name").html(response.country_name); $("#response").html(JSON.stringify(response, null, 4));}, "jsonp");</script></body></html>謝謝。
如何在輸入標(biāo)簽中傳遞值?
收到一只叮咚
2021-06-04 17:57:29