changing <ul> to <ul data-role="listview">
Hi,
I have a list which I'm displaying with icons and title only - no JQM formatting. If the screenwidth is below 320 px, I want to convert the list into a JQM <ul data-role="listview"> list.
I can add the attribute via Jquery, but when I call $('.menuList').listview('refresh'); I get the following error:
cannot call methods on listview prior to initialization; attempted to call method 'refresh'
Any clues as to what I'm doing wrong?
Thanks in advance.
Frequent
HTML:
- <ul class="menuList">
- <li>
- <div>
- <a href="l" data-transition="slide" rel="external" class="iconViewport icon">
- <span class="menuTitle">GoHere</span>
- <span class="pusher">111</span>
- </a>
- </div>
- </li>
- </ul>
Jquery
- function enhanceMobile ()
- {
- $('.menuList').attr('data-role', 'listview');
- $('.menuList').listview('refresh');
- }