Refresh after remove data-role

Refresh after remove data-role

When I remove data-role, I am unable to refresh/create the styling. Using simple example below,

  1. <ul id="lv1" class="" data-role="listview" data-icon="false">
    <li><a>item-1</a></li>
    <li><a>item-2</a></li>
    <li><a>item-3</a></li>
    </ul>
  2. <div onClick="$('#lv1').removeAttr('data-role'); $(#lv1').listview('refresh');">Remove class</div>


I think the code $(#lv1').listview('refresh') should not apply as the data-role=listview already being removed.


I also tried using $('#IdOfYourPage').page('destroy').page(); as suggested on (https://forum.jquery.com/topic/how-to-refresh-style-and-layout-of-radio-buttons-after-add-remove), it also doesn't works for me.


My actual need does not apply to listview only, I will need to apply it to specific DIV which may contain listview, selectoption etc. Therefore if can refresh/create that specific container would be perfect.


I'm using latest version of JQM and used FireFox to inspect. Based on my inspection, removing data-role is not enough as JQM automatically added several more classes and inner container.


Hope my explanation is clear enough. Any help / suggestion are very much appreciated. Thanks.