Question

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

Était-ce utile?

La solution

<?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".

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top