My code wont execute the alert() function. Can anybody help me? Here is the code:
hook.txt:
<html>
<div id="text">
<a href="#" class="name">george lucas</a>
<span class="fadetxt">knows</span>
<span class="subjectnames">physiology</span>
</div>
<div class="detail"></div>
</html>
knowledge.txt:
<html><p class="subjecttitle>Physiology</p></html>
javascript:
$(document).ready( function(){
$('#stdmatch').load("/hook.txt");
$('.subjectnames').click(function(){
$(this).alert("data");
});
});
@katie: You have to use
$.live()in order to match the class which was generated via$.load:Since the class is on a
<span>, I suggest you updatehook.txtto