I call a javascript function in my button onclick
.
JS Code:
function getusername(){
document.getElementById("strPwd").value="<?php echo get_user_name(); ?>";
}
Button Code:
<button class="btn btn-success" onclick="getusername()">Generate</button>
It works fine in the first run. But the problem is if I click again, it is not working. If I refresh the page it runs again.
What should I do ?