Naumche Ivanovski
Naumche Ivanovski

Reputation: 110

Datatables: Prevent html elements on inline edit

Prevent html elements on inline edit Datatables

    <td class="sorting_1">
      <input type="checkbox"> 
     <i class="fa fa-cubes"></i>
     Text Field
   </td>

enter image description here

DataTable editor

   $('#dynamic-table').on('click', 'tbody td', function (e) {
    editor.inline(this);
    });

Upvotes: 0

Views: 722

Answers (1)

Ashkan Aryan
Ashkan Aryan

Reputation: 3534

There are a number of ways you can do it. You can use a CSS/jQuery selector to find the first td elements in each tr and get the input element from them, and wire a jQuery blur event to them to strip disallowed characters (i.e. anything that's not alphanumeric) and / or warn/prevent user on blur, depending on how you want to handle it. You may also be able to use add a pattern attribute to input elements and provide a regex to do the same.

Upvotes: 1

Related Questions