如何将按钮更改为普通字符串

时间:2016-04-29 11:32:59

标签: twitter-bootstrap

当点击它时,如何将此按钮问号更改为常规文本问号?

<button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="bottom" title="About Company">?</button>

这是我想要实现的图片!

enter image description here http://i.imgur.com/gVYIRZw.png

1 个答案:

答案 0 :(得分:0)

&#13;
&#13;
<body>
    <div id="myDiv">
        <input type="button" value="?" id="submit" onClick="change()"> <!--button input that will trigger an event named change-->
    </div>
</body>
<script type="text/javascript">

function change(){ //function to run when you click on the button...
    var valueOfButton = document.getElementById("submit").value; 
    //create a variable with the value of the submit button
    document.getElementById("myDiv").innerHTML = valueOfButton; 
    // Here we are changing the value of myDiv. Replace the button with plain text.
}

</script>
&#13;
&#13;
&#13;

你想怎么做到这一点? 你尝试了什么? 我只有一个简单的解决方案。