Change listview theme via Javascript

Description

The following code shows how to change listview theme via Javascript.

Example


<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
  src='http://code.jquery.com/jquery-1.8.3.js'></script>
<script type='text/javascript'>//<![CDATA[ 
$(window).load(function(){<!--  w ww.  j  a v a 2s  . c  o m-->
$('#mybutton').on('click',function() {
    $("#myList li").attr("data-theme","b").trigger('mouseout');
    $("#my_list_item").attr("data-theme","e").trigger('mouseout');
});
});//]]>  
</script>
<link rel="stylesheet"
  href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
<script
  src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>
</head>
<body>
  <div data-role="page" id="index">
    <div data-role="content">
      <ul data-role="listview" id="myList" data-inset="true"
        id="movie-data" data-theme="a">
        <li><a href="">Acura</a></li>
        <li id="my_list_item"><a href="">Audi</a></li>
        <li><a href="">BMW</a></li>
      </ul>
      <button id="mybutton">Change</button>
    </div>
  </div>
</body>
</html>

Click to view the demo





















Home »
  jQuery Mobile »
    Example »




Button
Button Event
Button Icon
Button Text
Checkbox
Collapsible
Date
Dialog
Event
Footer
Form
Header
Icon
Input
Layout
Listview
Listview Divider
Listview Item
Loader
mobile_settings
Navbar
Page
Page Event
Popup
Radio
Select
Slider
Switch
Textarea
Theme