我正在尝试将innerElement设置为用户输入的值,但它会给我错误。代码如上,请帮助
*****代码*****
var abc= document.getElementById("searchbar").innerHTML = "Singapore Polytechnic"; --instead of Singapore Polytechnic I want it to be some values that was entered by the users.--
document.getElementById("searchbar").contentEditable = "true";
var test = abc;
答案 0 :(得分:0)
尝试以下方法:
<body>
<%= link_to image_tag('logo.png'), root_path %>
</body>
function changeVal(ele){
document.getElementById("searchbar").innerHTML = ele.value;
}
答案 1 :(得分:0)
我没有计划你的问题是什么,但也许你在寻找这个...
foreach($_POST["choice"] as $value_choice) {
if ($value_choice === end($_POST["choice"]))
{
echo "type = '$value_choice'";
}
else
{
echo "type = '$value_choice' OR ";
}
}
答案 2 :(得分:0)
我认为这就是你要找的东西
<强>代码强>
<input value="variable" id="val" onchange="changeVal(this)">
<强> TS 强>
onchange(this){
let var = event.target.getElementsByTagName('input').value;
}