Here, if I try a simple code like for you in any
JS fiddle[
^]:
HTML
<button type="button" class="fv-btn" onclick="user_register()">Register</button>
JS:
function user_register(){
alert('Hi');
}
It works perfectly as expected.
Now, based on error you shared, all it can mean, you might have missed adding Javascript reference. A Javascript file/code in
script
tag of your HTML page.
Try:
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>Demo example</title>
<script>
function user_register()
{
alert('Hi');
}
</script>
</head>
<body>
<button type="button" onclick="user_register()">Register</button>
</body>
</html>