0

is there a trick in html to call JS function() with the input value, like here :

example: here I want to call show_name( with the input[user_name] value )

Note: I don't wanna use JS

<form>
    <label>Enter your name :</label>
    <input type='text' name='user_name'>    
    <button type='submit' onclick='show_name( [want to get input value here] )' >Submit</button>
</form>
8
  • Your question is answered here Commented Mar 10, 2020 at 13:38
  • Does this answer your question? How to pass the button value into my onclick event function? Commented Mar 10, 2020 at 13:40
  • 1
    "Note: I don't wanna use JS" Why not? And how do you expect to call a JS function without JS? Commented Mar 10, 2020 at 13:42
  • @PedroBarroso thkx but (this) didnt make it because I have to call the function with a button not the input itself Commented Mar 10, 2020 at 13:50
  • 1
    @Mr.freelance indeed, it doesn't fit your exact question - here, I googled it to find a better fit: stackoverflow.com/questions/7427041/… Commented Mar 10, 2020 at 13:54

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.