I'm trying to get a checkbox before the list items in the listview. I have a page with listview when I click on the "edit" button. The listview adding the checkboxes before the list items but when I'm clicking on the checkbox's the page is automatically changes to the previous view (without checkboxes in listview).Checkboxes are not checked.where I'm doing wrong.
$('#fav').on('click', function() {
$("#favoritesList").listview('refresh');
fromStorage();
$(document).on('click', '#empty', function() {
$("#favoritesList").empty();
localStorage.clear();
$("#favoritesList").listview('refresh');
});
$(document).on('click', '#edit', function() {
fromGetStorage();
});
});
function fromGetStorage() {
$("#favoritesList").empty();
$(".ui-listview-filter").remove();
$("#favoritesList").append('<input type="checkbox" name="all" id="select" />Select all</br>');
for (var i = 0; i < localStorage.length; i++) {
var url = localStorage.key(i);
var demo = localStorage.getItem(url);
$("#favoritesList").append('<li><div><input type="checkbox" name="check" id="check"> <a href="' + url + '" style="text-decoration:none;color:black">' + demo + '</a></div></li>').attr('url', url);
$("#favoritesList").listview('refresh');
$('#select').click(function() {
if ($("#select").is(':checked')) {
$("#check").prop("checked", true);
}
else {
$("#check").prop("checked", false);
}
$("#favoritesList").listview('refresh');
}
$("#check").prop("checked", false).checkboxradio('refresh');