I want create an dynamic HTML page were the class name is defined by the php program
My code:
<?php
error_reporting(E_ALL);
ini_set("display_errors", 1);
?>
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function hideTd(){
var elements = document.getElementsByClassName("ca");
for(var i = 0, length = elements.length; i < length; i++) {
elements[i].style.display = 'none';
}
}
</script>
</head>
<body onload="hideTd()">
<select name="retailerselect" id="retailerselect" onchange="retailerSelect()" width: 66px;>
<option selected="selected" size="10" >--SELECT--</option>
<option class="ca">hi</option>
<option class="ca">this</option>
<?php $connect = " yes-ad";?>
<option class="<?php echo $connect;?>"> <?php echo $connect;?> </option>
</select>
</body>
</html>
I the HTML script i would have hide the value of option tag in the class "ca"
Input:
$connect:"yes-ad"
Output:
class="ad" value in the option ="yes-ad"
Sorry if my script is wrong i am a newbie in HTML or is there any other way to do this
Edit: Simplified the script
The Output iam getting now
I want it to show yes-ad with its class