<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<div class='tableWrap'>
<table class='styled-table'>
<thead>
<tr>
<th>Add</th>
<th>DWG_NO</th>
<th>Description</th>
<th>Profile</th>
<th>Pcs</th>
<th>Length</th>
<th>Ib_ft</th>
<th style="width:100%;">Observation</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<button type='button' onclick='dosomethingcrazy(this)'>Try</button>
</td>
<td>DWG_NO</td>
<td>Description</td>
<td>Profile</td>
<td><textarea rows='1' cols='3' id='myTextarea' name='something'>0</textarea></td>
<td>Length</td>
<td>Ib/ft</td>
<td>Observ</td>
</tr>
<tr>
<form id='form1' action='insert.php' method='post'>
<input type='hidden' id='greeting' name='test' value='one'>
<td><button type='button' onclick='dosomethingcrazy(this)'>Try</button></td>
<td><input type='text' name='drawingnum' placeholder='Drawing #'></td>
<td><input type='text' name='type' placeholder='Type' required></td>
<td><input type='text' name='profile' placeholder='profile' required></td>
<td><input type='number' min='0' name='pieces' placeholder='0'></td>
<td><input type='number' min='0' name='length' placeholder='0' required></td>
<td><input type='number' min='0' name='ibft' placeholder='0' required></td>
<td><textarea class='description' oninput = 'auto_grow(this)' type='text' name='description' value='initiate-value'></textarea></td>
</form>
</tr>";
</tbody>
</table>
</div>
<script>
function dosomethingcrazy(a)
{
// mixing up php and javascript notation.
// javascript doesn't use '$' for variables.
console.log('hello');
var row = a.closest('tr'); // Find the row
// Are you using jquery? if you are you can use find, but if not, then use querySelector.
// If you are not using a library then use .value to get the input value.
var text = row.querySelector('[name="drawingnum"]').value; // Find the text
// Let's test it out
alert(text);
}
</script>
</body>
</html>
Output
300px
You can jump to the latest bin by adding /latest
to your URL
Keyboard Shortcuts
Shortcut | Action |
---|---|
ctrl + [num] | Toggle nth panel |
ctrl + 0 | Close focused panel |
ctrl + enter | Re-render output. If console visible: run JS in console |
Ctrl + l | Clear the console |
ctrl + / | Toggle comment on selected lines |
ctrl + ] | Indents selected lines |
ctrl + [ | Unindents selected lines |
tab | Code complete & Emmet expand |
ctrl + shift + L | Beautify code in active panel |
ctrl + s | Save & lock current Bin from further changes |
ctrl + shift + s | Open the share options |
ctrl + y | Archive Bin |
Complete list of JS Bin shortcuts |
JS Bin URLs
URL | Action |
---|---|
/ | Show the full rendered output. This content will update in real time as it's updated from the /edit url. |
/edit | Edit the current bin |
/watch | Follow a Code Casting session |
/embed | Create an embeddable version of the bin |
/latest | Load the very latest bin (/latest goes in place of the revision) |
/[username]/last | View the last edited bin for this user |
/[username]/last/edit | Edit the last edited bin for this user |
/[username]/last/watch | Follow the Code Casting session for the latest bin for this user |
/quiet | Remove analytics and edit button from rendered output |
.js | Load only the JavaScript for a bin |
.css | Load only the CSS for a bin |
Except for username prefixed urls, the url may start with http://jsbin.com/abc and the url fragments can be added to the url to view it differently. |