htmljquerycustom-data-attributejquery-data

jQuery Mobile- Control clearBtn programmatically


I am using jQuery Mobile 1.3.2. I have a textbox with data-clear-btn=true.

Whenever the user typing the characters in the textbox, once it reaches the end the delete icon hiding the characters in the textbox:

enter image description here

I would like to hide the delete icon, once the user tabs out. I have tried using

$("#elementId").textinput("option", "clearBtn", false);

but it is not hiding the clear button. Why not?


Solution

  • Instead of hiding the control button, by adding the css, I have moved the delete icon outside the textbox, which allows the user the see the content inside the textbox.enter image description here

    $(".ui-input-clear").each(function(element){
                $(this).css("right","-32px");
    });