I'm using the code I found here...Clearable input
Which works as expected but when I use it in my page everything works except for the cirsor changing when hovering over the 'x'. The only time it works is if the input box is disabled.
Another thing I noticed is that the code will not work unless I add the following to my css file not sure if it's related or not...
.ui-autocomplete{}
I think it might have to do with bringing the image to the front but everything I've tried doesn't work.
EDIT: Added screenshots to show problem...
Cursor changes when input is disabled...
Cursor doesn't change when enabled...
Basically trying to get the cursor to change to the hand when input is enabled.
Updated code to this... still have issues but wanted to update with new code.
$(function($){
function tog(v){return v?'addClass':'removeClass';}
$(document).on('mouseenter', '.clearable', function(){
if ($(this).prop('disabled')===false) {
$(this)[tog(this.value)]('x');
}
}).on('mousemove', '.x', function(e){
$(this)[tog(this.offsetWidth-18 < e.clientX-this.getBoundingClientRect().left)]('onX');
}).on('mouseleave', '.x', function(){
$(this).removeClass('x');//.val('').change();
}).on('click', '.onX', function(ev){
ev.preventDefault();
$(this).removeClass('x onX').val('').change();
$(this).trigger('keyup');
});
});