JSFiddle - React, Tailwind, and code Playground
by mavdhana
HTML
<input type='button' value='button1' class='button' name='firstButton'/><br><br>
<input type='button' value='button2' class='button' name='secondButton'/><br><br>
<input type='file' name='file' value='file upload'/><br><br>
<input type='submit' value='submit' id='submit'>
CoffeeScript
do ->
buttonValue = {}
$('input[type=button]').click ->
name = $(this).attr('name')
buttonValue[name] = $(this).val()
return
$('#submit').click ->
$('input[type=file]').click ($i) ->
name = $(this).attr('name')
buttonValue[name] = $(this).val()
return
console.log JSON.stringify(buttonValue)
return
return