javascript keyup event occurrence error question

Asked 2 years ago, Updated 2 years ago, 34 views

// keyUp
function k_e(a, b , c)
{
    console.log(margin);
}

<input type="text" onKeyUp="k_e('1','2','3');"/>

error : Uncaught ReferenceError: k_e is not defined

I don't know the cause. Why can't I find it?

javascript jquery html

2022-09-21 20:24

1 Answers

https://jsfiddle.net/8snsvbs7/

<script>
// // keyUp
function k_e(a, b , c)
{
    // // doSomething
    console.log(a,b,c);
}
</script>
<input type="text" onKeyUp="k_e('1','2','3');"/>

The preceding function k_e is <script>..Did you wrap it up with </script>?

Then, <script> should appear before the <input> you use.


2022-09-21 20:24

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.