Home > front end >  Remove Title attribute from an Object of Select2
Remove Title attribute from an Object of Select2

Time:01-27

I need to remove Title attribute of templateResult function of enter image description here

I can console.log the object with below code.

      function resultfucntion(state) {

        console.log(state);

        //state.removeAttribute("title");

        if (!state.id) { return state.text;}
        var $state = $(
          '<span>'   state.text   '('  state.text1  ')</span>'
        );
        return $state;
      };

I am getting output of the object like below.

Object { id: "1", text: "admin", text1: 0, title: "<table>                       <tr>                         <td>Organisation</td>                         <td>null</td>                       </tr>                       <tr>                         <td>Age</td>                         <td></td>                       </tr>                     </table>" }

enter image description here

CodePudding user response:

use this command

delete state.title

state will be

{id: '1', text: 'admin', text1: 0}
  •  Tags:  
  • Related