I want to replace English text by Arabic text which is coming before and after a dropdown field

I want to replace English text by Arabic text which is coming before and after a dropdown field

maazasif63maazasif63 Posts: 2Questions: 1Answers: 0
edited July 2023 in Free community support

My code replaces the text but the functionality of the dropdown stops working once this js is executed otherwise before it the dropdown works fine.

var input = $("#DataTables_Table_0_length > label > input").detach();
$("#DataTables_Table_0_length > label")
  .html(
    'يبحث <select name="DataTables_Table_0_length" aria-controls="DataTables_Table_0" class="custom-select custom-select-sm form-control form-control-sm"><option value="10">10</option><option value="25">25</option><option value="50">50</option><option value="100">100</option></select> abc ',
  )
  .append(input);

Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 62,858Questions: 1Answers: 10,344 Site admin
    Answer ✓

    Yes, because you've replaced the DOM elements that DataTables put into the document which removes their event listeners.

    Instead of doing that, use language.lengthMenu to customise the text shown.

    Allan

  • maazasif63maazasif63 Posts: 2Questions: 1Answers: 0
    edited July 2023

    @allan can you please provide an example . I only need to replace the text coming before and after the dropdown and nothing is to be changed in the dropdown menu

  • allanallan Posts: 62,858Questions: 1Answers: 10,344 Site admin
Sign In or Register to comment.