there must be something small ive overlooked here. I’m simply trying to select all DT elements in a DL and insert some HTML and add a click event, however it only seems to be applying to the first DT.
Here’s the snippet from my plugin:
return this.each(function(){
var questions = $(this).find('dt');
questions.each(function(){
$(this).attr("title","Show answer"); // add screen tip
$(this).wrapInner("<span class='faqToggleQues' />");
$(this).prepend("<span class='faqToggleNumber'>"+numPrefix+(i+1)+numSubfix+"</span>");
});
});
Also I have hosted the code on jsFiddle http://jsfiddle.net/mindfriction/u6WYQ/
Based on the new link you have provided i have updated the code http://jsfiddle.net/u6WYQ/6/
need to use defaults.numPrefix instead just numPrefix.Also you can hide dd default in by having init method.Also merge the options with default to apply user settings.