Pages

Saturday, May 15, 2010

My first try in Jquery .... :)

Tried a fix for Toggle-css-in-multiple-instances-individually
Include the Script & Style within Head tag

$(document).ready(function(){
$('.showAnswer').click(function(){
var htmlStr = $("li.theAnswer").html();
$("li.theAnswer").html($("li.theAnswer").text().replace(htmlStr,''+htmlStr+''));
$(this).text($(this).text() == 'Hide Answer' ? 'Show Answer' : 'Hide Answer');
});
});


Include the code in Body tag
A list with one alone with class for example
.. class="theAnswer"(C) 6 to 7..
Have A hyperlink with class class="showAnswer"



View Demo

No comments:

Post a Comment