ID for moved search box

ID for moved search box

emilemil Posts: 7Questions: 1Answers: 1

Hi,
the solution to my question is probably very simple.
I moved my search box using:

initComplete : function() {
$("#example_filter").detach().appendTo('#new-search-area');
}

but now my search box has no ID:

<input type="search" class="" placeholder="" aria-controls="example">

Is there a way to add the ID?

Web:
http://st3p.com/telefonny_zoznam/teldt.html

Thanks,
Emil

Replies

  • allanallan Posts: 63,686Questions: 1Answers: 10,500 Site admin

    I don't believe the search box DataTables adds ever has an id. It certainly wouldn't be stripped just because you moved it. What makes you think it had an id in the first place?

    Allan

  • emilemil Posts: 7Questions: 1Answers: 1

    It probably never had one. Is there a way to assign it an ID value? It would help me a lot with further programming.

  • allanallan Posts: 63,686Questions: 1Answers: 10,500 Site admin

    $("#example_filter input").prop( 'id', ... ) would do it.

    Allan

  • emilemil Posts: 7Questions: 1Answers: 1

    Thank you Allan!

          initComplete : function() {
                 $("#example_filter input").prop( 'id', 'search_box' );
                 $("#example_filter").detach().appendTo('#new-search-area');
            },
    

    assigns id="search_box" and then moves it to the new div.

This discussion has been closed.