Add hidden data to HTML table












0















Is it possible to add hidden variables to a HTML table row?
Which can be accessed when processing each row in jQuery?



Thanks










share|improve this question























  • 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
















0















Is it possible to add hidden variables to a HTML table row?
Which can be accessed when processing each row in jQuery?



Thanks










share|improve this question























  • 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














0












0








0








Is it possible to add hidden variables to a HTML table row?
Which can be accessed when processing each row in jQuery?



Thanks










share|improve this question














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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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



















  • 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












4 Answers
4






active

oldest

votes


















3














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;
}





share|improve this answer


























  • Awesome the second one is exactly what I'm looking for

    – Uskompuf
    Jan 1 at 6:44



















0














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>





share|improve this answer































    0














    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.






    share|improve this answer































      0














      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;
      }





      share|improve this answer























        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
        });


        }
        });














        draft saved

        draft discarded


















        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









        3














        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;
        }





        share|improve this answer


























        • Awesome the second one is exactly what I'm looking for

          – Uskompuf
          Jan 1 at 6:44
















        3














        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;
        }





        share|improve this answer


























        • Awesome the second one is exactly what I'm looking for

          – Uskompuf
          Jan 1 at 6:44














        3












        3








        3







        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;
        }





        share|improve this answer















        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;
        }






        share|improve this answer














        share|improve this answer



        share|improve this answer








        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



















        • 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













        0














        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>





        share|improve this answer




























          0














          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>





          share|improve this answer


























            0












            0








            0







            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>





            share|improve this answer













            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>






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Jan 1 at 6:46









            David BrayDavid Bray

            26428




            26428























                0














                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.






                share|improve this answer




























                  0














                  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.






                  share|improve this answer


























                    0












                    0








                    0







                    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.






                    share|improve this answer













                    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.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Jan 1 at 6:49









                    Ayan_84Ayan_84

                    510411




                    510411























                        0














                        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;
                        }





                        share|improve this answer




























                          0














                          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;
                          }





                          share|improve this answer


























                            0












                            0








                            0







                            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;
                            }





                            share|improve this answer













                            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;
                            }






                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Jan 1 at 6:56









                            SushilSushil

                            750221




                            750221






























                                draft saved

                                draft discarded




















































                                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.




                                draft saved


                                draft discarded














                                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





















































                                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







                                Popular posts from this blog

                                Mossoró

                                Error while reading .h5 file using the rhdf5 package in R

                                Pushsharp Apns notification error: 'InvalidToken'