Hi everyone.
I am trying to 'replace' the button on select inputs. I have looked at the select replacement plugins in jquery but they are all a little bloated IMO. What I'd like to achieve is a simple span positioned over the dropdown button of the select box and when it is clicked make the select options drop.
Here is what I have:
$(document).ready(function(){
$('select').after('<span class="cta arrow-down"></span>');
$('input[type="submit"]').after('<span class="cta arrow-right"></span>');
$('span.cta').each(function(){
var $this = $(this);
var $prev = $this.prev();
var $dim = $prev.position();
$this.css({'top':$dim.top, 'right':0, 'height':$prev.outerHeight(), 'width':$prev.outerHeight()});
$this.click(function(){
$prev.trigger('click');
});
});
});
I have tried mousedown and also click and mousedown with triggerHandler calling a relevant func but to no avail...
Is this possible at all?