How do I add a label to the on the search input field

How do I add a label to the on the search input field

sjwsjw Posts: 24Questions: 6Answers: 0

Hello, How do I add an aria-label= to the <label> tag on the search input field?
thanks

This question has an accepted answers - jump to answer

Answers

  • ThomDThomD Posts: 334Questions: 11Answers: 43
    edited October 2015

    In the initComplete add this code

         $('#example_filter label).attr('aria-label', 'myInput');
    

    'example' is the table id value.

  • sjwsjw Posts: 24Questions: 6Answers: 0

    HI can you show me where it goes in here thanks:

    $(document).ready(function(){ $('#sessionalPapersTable').dataTable( { "paging": false, "ordering": false, "info": false } ); });
  • ThomDThomD Posts: 334Questions: 11Answers: 43
    Answer ✓

    Her is the link to the documentation on that option.

    https://datatables.net/reference/option/initComplete

  • sjwsjw Posts: 24Questions: 6Answers: 0

    I've tried this but it doesn't work:
    $(document).ready(function(){
    $('#sessionalPapersTable').dataTable( {

    "initComplete": function(settings, json) {
    $('#sessionalPapersTable label).attr('aria-label', 'Start typing to filter results in the table below');
    }
    } );
    });

  • jLinuxjLinux Posts: 981Questions: 73Answers: 75

    Shot in the dark, instead of attr. Try prop

  • sjwsjw Posts: 24Questions: 6Answers: 0

    no luck. thx

This discussion has been closed.