I found some helpful input on google but I can't seem to get it working just right..
Any feedback would be greatly appreciated!
Here's my HTML
<a href = "javascript: void();" id = "showOptionalData">[+] Show Optional Data</a>
Here's my jQuery
$(document).ready(function(){
$('#showOptionalData').click(function showOptionalData(){
if($(this+":contains('Hide')").length > 0){
$(this).text('[+] Show Optional Data');
}else{
$(this).text('[-] Hide Optional Data');
}
$('.optional').toggle('slow');
});
});
I also tried this jQuery (just to see)
var $txt = $(this).text();
if($($txt).find('Hide')){
$(this).text('[+] Show Optional Data');
}else{
$(this).text('[-] Hide Optional Data');
}
As always, thanks in advance!!
This post has been edited by guyfromri: 18 November 2012 - 01:47 PM

New Topic/Question
Reply



MultiQuote


|