Can i put class name in title of div? It's possible?

<div class="flag brasileña" title="phpcode"></div>

I want put in title, text of second class "brasileña" with php code or similar

有帮助吗?

解决方案

<?php 
$className = "flag brasileña";
$alt = explode(" ", $className);
?>

<div class='<?php echo $className ?>' title='<?php echo $alt[1] ?>'></div>

Assuming class name always has two words and alt always take the second word and since you mentioned you want to do it by php the class name is generated dynamically.

This is how you can do it but this wont serve any purpose. Whats that you want to do with adding second word to "alt".

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top