@poonkave
Alternatively to an id or class, you could try using a data-xyz attribute, which would allow you to bind:
$(document).on('click', 'ul li', function(){
var target = $(this).jqmData("xyz");
// do something
});
Regarding split lists:
The default JQM ui-icon will be 18x18px, so as @watusi says, this is pretty hard to hit... :-) I'd also go with the split button, which I think works just fine for that.
I'm doing deletes/submits out of a listview like this:
// listview
<ul data-role="listview" data-inset="true" data-divider-theme="a" class="nMT">
<li data-role="list-divider"><span class="ui-divider-text">some text</span></li>
<li data-icon="setup"><a href="##" class="loadDelAdress" data-show="_my_id_">_text_</a></li>
</ul>
I'm loading this list in via Ajax. Once the list has loaded and enhanced, I'm running a function setting up element bindings like so:
var bindRegister = function() {
...
// load form EDIT
$('.loadDelAdress').on('click', function(){
var in_param = "edit_delivery",
in_acc = $(this).jqmData('show');
// whatever you want to do
spin( "show" );
ajaxUpdate( "tmp_delivery.cfm", $('.deliveryWrapper'), in_param, in_acc );
});
}
Your problem might be that when your bindings are set, JQM has not finished enhancing the page/all elements, so the class you are trying to bind to or the element itself may not have been added by JQM (console .ui-icon.length to see). That's why I'm binding to LI and set a data-show attribute in the unenhanced markup.
Also, if you are binding to the icon, what are you trying to preventDefault? The icon itself will not have anything worth preventing.