Change data-icon on click with jquery mobile

前端 未结 4 1151
独厮守ぢ
独厮守ぢ 2021-01-18 12:58

This is my code:

function togglePOIAndDisplay(toggle){
    var display = $(toggle).attr(\'data-icon\');
    console.log(display);
    if(display == \'minus\'         


        
4条回答
  •  广开言路
    2021-01-18 13:43

    http://jsfiddle.net/phillpafford/8pwFK/29/

    change custom icon to star icon.

    $(this).attr('data-icon','star');
    $(this).find('.ui-icon').removeClass('ui-icon-custom').addClass('ui-icon-star');
    

    this example is easy to study.

提交回复
热议问题