Add hidden data to HTML table
Is it possible to add hidden variables to a HTML table row?
Which can be accessed when processing each row in jQuery?
Thanks
jquery html
add a comment |
Is it possible to add hidden variables to a HTML table row?
Which can be accessed when processing each row in jQuery?
Thanks
jquery html
what do you mean by hidden ? jQuery supports $( element).data('myvar', 'the value');
– David Bray
Jan 1 at 6:41
I want to be able to add data to table rows which isn't actually displayed to the user
– Uskompuf
Jan 1 at 6:42
add a comment |
Is it possible to add hidden variables to a HTML table row?
Which can be accessed when processing each row in jQuery?
Thanks
jquery html
Is it possible to add hidden variables to a HTML table row?
Which can be accessed when processing each row in jQuery?
Thanks
jquery html
jquery html
asked Jan 1 at 6:38
UskompufUskompuf
947
947
what do you mean by hidden ? jQuery supports $( element).data('myvar', 'the value');
– David Bray
Jan 1 at 6:41
I want to be able to add data to table rows which isn't actually displayed to the user
– Uskompuf
Jan 1 at 6:42
add a comment |
what do you mean by hidden ? jQuery supports $( element).data('myvar', 'the value');
– David Bray
Jan 1 at 6:41
I want to be able to add data to table rows which isn't actually displayed to the user
– Uskompuf
Jan 1 at 6:42
what do you mean by hidden ? jQuery supports $( element).data('myvar', 'the value');
– David Bray
Jan 1 at 6:41
what do you mean by hidden ? jQuery supports $( element).data('myvar', 'the value');
– David Bray
Jan 1 at 6:41
I want to be able to add data to table rows which isn't actually displayed to the user
– Uskompuf
Jan 1 at 6:42
I want to be able to add data to table rows which isn't actually displayed to the user
– Uskompuf
Jan 1 at 6:42
add a comment |
4 Answers
4
active
oldest
votes
you can add as row id,
<tr id="your value"><td></td></tr>
or you can make
<td class="hide"> your value</td>
and do some css like this
.hide{
display:none;
}
Awesome the second one is exactly what I'm looking for
– Uskompuf
Jan 1 at 6:44
add a comment |
Like
<table>
<tr id="theTargetRow" data-id="2">
<td>My Name</td>
</tr>
</table>
and can be retrieved by
<script>
$(document).ready( function() {
$('#theTargetRow').data('id') // 2
})
</script>
add a comment |
One way of binding data to html element is using data-atrribute, like <tr data-employee="{emp_id:100,emp_name:John}"><td>....</td></tr>
later you can get or set the attribute using $(tr).attr('data-employee') // Get The Data
$(tr).attr('data-employee',varEmployeeData) // Set the Employee Data
You can also use Jquery .data method.
add a comment |
addstyle="display:none;" in which data you want to hide i.e tr or td and you can access while processing each row
Also you can add some class i.e. attr class="className" and add CSS
.className{
display:none;
}
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53993507%2fadd-hidden-data-to-html-table%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
you can add as row id,
<tr id="your value"><td></td></tr>
or you can make
<td class="hide"> your value</td>
and do some css like this
.hide{
display:none;
}
Awesome the second one is exactly what I'm looking for
– Uskompuf
Jan 1 at 6:44
add a comment |
you can add as row id,
<tr id="your value"><td></td></tr>
or you can make
<td class="hide"> your value</td>
and do some css like this
.hide{
display:none;
}
Awesome the second one is exactly what I'm looking for
– Uskompuf
Jan 1 at 6:44
add a comment |
you can add as row id,
<tr id="your value"><td></td></tr>
or you can make
<td class="hide"> your value</td>
and do some css like this
.hide{
display:none;
}
you can add as row id,
<tr id="your value"><td></td></tr>
or you can make
<td class="hide"> your value</td>
and do some css like this
.hide{
display:none;
}
edited Jan 1 at 6:44
answered Jan 1 at 6:43
KhageshKhagesh
1138
1138
Awesome the second one is exactly what I'm looking for
– Uskompuf
Jan 1 at 6:44
add a comment |
Awesome the second one is exactly what I'm looking for
– Uskompuf
Jan 1 at 6:44
Awesome the second one is exactly what I'm looking for
– Uskompuf
Jan 1 at 6:44
Awesome the second one is exactly what I'm looking for
– Uskompuf
Jan 1 at 6:44
add a comment |
Like
<table>
<tr id="theTargetRow" data-id="2">
<td>My Name</td>
</tr>
</table>
and can be retrieved by
<script>
$(document).ready( function() {
$('#theTargetRow').data('id') // 2
})
</script>
add a comment |
Like
<table>
<tr id="theTargetRow" data-id="2">
<td>My Name</td>
</tr>
</table>
and can be retrieved by
<script>
$(document).ready( function() {
$('#theTargetRow').data('id') // 2
})
</script>
add a comment |
Like
<table>
<tr id="theTargetRow" data-id="2">
<td>My Name</td>
</tr>
</table>
and can be retrieved by
<script>
$(document).ready( function() {
$('#theTargetRow').data('id') // 2
})
</script>
Like
<table>
<tr id="theTargetRow" data-id="2">
<td>My Name</td>
</tr>
</table>
and can be retrieved by
<script>
$(document).ready( function() {
$('#theTargetRow').data('id') // 2
})
</script>
answered Jan 1 at 6:46
David BrayDavid Bray
26428
26428
add a comment |
add a comment |
One way of binding data to html element is using data-atrribute, like <tr data-employee="{emp_id:100,emp_name:John}"><td>....</td></tr>
later you can get or set the attribute using $(tr).attr('data-employee') // Get The Data
$(tr).attr('data-employee',varEmployeeData) // Set the Employee Data
You can also use Jquery .data method.
add a comment |
One way of binding data to html element is using data-atrribute, like <tr data-employee="{emp_id:100,emp_name:John}"><td>....</td></tr>
later you can get or set the attribute using $(tr).attr('data-employee') // Get The Data
$(tr).attr('data-employee',varEmployeeData) // Set the Employee Data
You can also use Jquery .data method.
add a comment |
One way of binding data to html element is using data-atrribute, like <tr data-employee="{emp_id:100,emp_name:John}"><td>....</td></tr>
later you can get or set the attribute using $(tr).attr('data-employee') // Get The Data
$(tr).attr('data-employee',varEmployeeData) // Set the Employee Data
You can also use Jquery .data method.
One way of binding data to html element is using data-atrribute, like <tr data-employee="{emp_id:100,emp_name:John}"><td>....</td></tr>
later you can get or set the attribute using $(tr).attr('data-employee') // Get The Data
$(tr).attr('data-employee',varEmployeeData) // Set the Employee Data
You can also use Jquery .data method.
answered Jan 1 at 6:49
Ayan_84Ayan_84
510411
510411
add a comment |
add a comment |
addstyle="display:none;" in which data you want to hide i.e tr or td and you can access while processing each row
Also you can add some class i.e. attr class="className" and add CSS
.className{
display:none;
}
add a comment |
addstyle="display:none;" in which data you want to hide i.e tr or td and you can access while processing each row
Also you can add some class i.e. attr class="className" and add CSS
.className{
display:none;
}
add a comment |
addstyle="display:none;" in which data you want to hide i.e tr or td and you can access while processing each row
Also you can add some class i.e. attr class="className" and add CSS
.className{
display:none;
}
addstyle="display:none;" in which data you want to hide i.e tr or td and you can access while processing each row
Also you can add some class i.e. attr class="className" and add CSS
.className{
display:none;
}
answered Jan 1 at 6:56
SushilSushil
750221
750221
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53993507%2fadd-hidden-data-to-html-table%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
what do you mean by hidden ? jQuery supports $( element).data('myvar', 'the value');
– David Bray
Jan 1 at 6:41
I want to be able to add data to table rows which isn't actually displayed to the user
– Uskompuf
Jan 1 at 6:42