i have a link that contain some data
eg
<li><a href="" onclick="getcategory(this);"><?php echo $result22['category']; ?></a></li>
i want this link to pass this $result22['category']; value to the ajax function
am trying this
<script type="text/javascript">
function getcategory(cat)
{
var id = cat.value;
alert("hi" + id);
}
</script>
but its shows hi undefined in alert box
what am doing wrong ?
am not getting correct value of $result22['category']; in alert box
Since
catis anaelement, it won’t have avalueproperty. UsetextContentorinnerText(orinnerHTMLif there could be child elements):It’s generally only form controls that have a value property (the
inputelement for example).