html - Get the name of ONE element when it is clicked in PHP -


i'm wondering how can name of element when clicked in php, elements have same name instance...

php:

<?php     $playlist_names = array("chill", "groovy", "pastasauce", "dank songs", "katy perry");      ($i = 0; $i < count($playlist_names); $i++) {         echo "<a href=\"\" class=\"playlist-name\" name=\"$x\">$playlist_names[$i]<img src=\"http://i.imgur.com/pllny9d.png\" class=\"gear-icon\" /></a>";     } ?> 

what i'm trying when "playlist-name" clicked - return playlist name in different div text "editing [name of playlist here]"

this seem simple problem, helping out!

use $(this).text(); text inside html element

for case retrive first element text can use selector :

$("div p:nth-child(1)").text();

and 1 other ones .


Comments

Popular posts from this blog

java - Could not locate OpenAL library -

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

sorting - opencl Bitonic sort with 64 bits keys -