Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
154
rated 0 times [  161] [ 7]  / answers: 1 / hits: 84746  / 11 Years ago, mon, march 18, 2013, 12:00:00

I have this div



<div class=RestauranstSection>
<label>
Restaurant:
</label>
<input type=text/>
<input type=button value=Search/>
<ul>
<?php while ($row = $restaurants->fetch()) {
?>
<li id=<?php echo $row['ID']; ?>>
<?php echo $row['name']; ?>
</li>
<?php } ?>
</ul>
</div>


I want when press on any li elements to alert its text,



$(.RestauranstSection).on('click','li',function (){});


how please?


More From » jquery

 Answers
21
$(.RestauranstSection).on('click','li',function (){
alert($(this).text());
});

[#79519] Sunday, March 17, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jimmieo

Total Points: 515
Total Questions: 102
Total Answers: 110

Location: Kazakhstan
Member since Mon, Sep 26, 2022
2 Years ago
;