How to manipulate Jquery Accordian Header text value

后端 未结 1 1854
粉色の甜心
粉色の甜心 2021-01-27 06:04

I am having a Jquery Accordian , which creates nested Accordians based on the search result .

This is my jsfiddle

http://jsfiddle.net/DBYLk/25/

Initial

1条回答
  •  梦毁少年i
    2021-01-27 07:04

    Firstly, you are appending many divs with the same id which is wrong.

    Secondly this is made somewhat harder by your JSON structure. Do you have the ability to modify that at all? This would make things much easier to handle.

    However you can store the entire "path" via jQuery's data attribute and replace the basePath with nothing e.g.

    var tempName = response[i].replace(selectedeleemnt + "***", "");
    html+="
    ";

    Also the PopCorn in your JSON needs to be uniform as currently you have PopCorn and then Popcorn***

    Handling the data thereafter is a matter of manipulating the selectedeleemnt by doing a check if it hasData and then using that instead of the headerText.

    Demo:http://jsfiddle.net/robschmuecker/DBYLk/33/

    0 讨论(0)
提交回复
热议问题