javascript - How to send table value with form, radio button? -


example

html code in table

<table>    <tr>      <td> <input type='text' value='example 1' name='text1' /></td>      <td> <input type='radio' value='example 1' name='radio1' /></td>    </tr>    <tr>      <td> <input type='text' value='example 2' name='text2' /></td>      <td> <input type='radio' value='example 2' name='radio2' /></td>    </tr>    <tr>      <td> <input type='text' value='example 3' name='text3' /></td>      <td> <input type='radio' value='example 3' name='radio3' /></td>    </tr>  </table>

i want send clicked value when if radio button clicked

button

1 clicked -> send radio 1 value

2 clicked -> send radio 2 value

3 clicked -> sens radio 3 value

so question

how send table value form, radio button?

you can javascript. "listen" click event each input.

you can send server using ajax.

[].foreach.call(document.queryselectorall('input'), function(input) {    input.addeventlistener('click', function(elm) {      console.log(input.value);      // send value server ajax or    });  });
<table>    <tr>      <td> <input type='text' value='example 1' name='text1' /></td>      <td> <input type='radio' value='example 1' name='radio1' /></td>    </tr>    <tr>      <td> <input type='text' value='example 2' name='text2' /></td>      <td> <input type='radio' value='example 2' name='radio2' /></td>    </tr>    <tr>      <td> <input type='text' value='example 3' name='text3' /></td>      <td> <input type='radio' value='example 3' name='radio3' /></td>    </tr>  </table>


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -