Putting icon instead of “ + ” or “ - ” in an accordian menu.js file

前端 未结 2 1628
南方客
南方客 2021-01-25 21:02

I am making an accordian menu.
I just found this link http://jsfiddle.net/zM5Vj/ , and it is almost similar to the accordian menu I have made.
In the code, where there i

2条回答
  •  無奈伤痛
    2021-01-25 21:18

    Thank You All for responding and helping me in solving it.
    @Simon Adcock, Your answer gave me a new way to think about the solution.
    However, i also found a 1 line solution to it.
    I just added this line to my .js file

     $(this).append($(''))
    

    So, answer finally it is :

    if (x == "block") {
            $(this).text('');
            $(this).append($(''))
            $(this).append(' ' + valueText);
        }
        else {
            $(this).text('');
            $(this).append($(''))
            $(this).append(' ' + valueText);
        }
    

提交回复
热议问题