Need help with onclick if else statement.
I have an onclick=getElementById that display a hidden div, but need some conditions before display.
The condition variable is in a xml file - herewith code ( I made a fiddle example but unsure how to add php code in fiddle) - http://ift.tt/2t4F6Y4
<?php
if (!empty($linkwebsite->nodeValue)){
echo "<a href='$linkwebsite->nodeValue' class='button1' target='_blank'>$ctabutton->nodeValue</a>";
}
else{
echo "<a href='//www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=$ppy->nodeValue' class='button1' target='_blank'>Unlock MyMobi</a>";
}
?>
I need to incorporate the condition as follow :- if variable $linkwebsite->nodeValue is empty it must display "Unlock Demo" and if click must follow nodeValue'>
if variable $linkwebsite->nodeValue is populated it must display $ctabutton->nodeValue and when click must display the hidden div (onclick=getElementById)
I have added the php code in the fiddle but I know it is not html but just an idea what i want to achieve
Help will be highly appreciated
Aucun commentaire:
Enregistrer un commentaire