How can I force WebKit to redraw/repaint to propagate style changes?

后端 未结 27 2298
我寻月下人不归
我寻月下人不归 2020-11-22 02:04

I have some trivial JavaScript to effect a style change:

sel = document.getElementById(\'my_id\');
sel.className = sel.className.replace(/item-[1-9]-selected         


        
27条回答
  •  迷失自我
    2020-11-22 02:28

    above suggestions didnt work for me. but the below one does.

    Want to change the text inside the anchor dynamically. The word "Search". Created an inner tag "font" with an id attribute. Managed the contents using javascript (below)

    Search
    

    script contents:

        var searchText = "Search";
        var editSearchText = "Edit Search";
        var currentSearchText = searchText;
    
        function doSearch() {
            if (currentSearchText == searchText) {
                $('#pSearch').panel('close');
                currentSearchText = editSearchText;
            } else if (currentSearchText == editSearchText) {
                $('#pSearch').panel('open');
                currentSearchText = searchText;
            }
            $('#searchtxt').text(currentSearchText);
        }
    

提交回复
热议问题