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

node.js - How to mock a third-party api calls in the backend -

node.js - Why do I get "SOCKS connection failed. Connection not allowed by ruleset" for some .onion sites? -

matlab - 0-by-1 sym - What do I need to change in order to get proper symbolic results? -