I have a set of nested elements like such.
<div id="master">
<span id="num-1" class="num"></span>
<span id="num-2" class="num"></span>
<span id="num-3" class="num"></span>
<span id="num-4" class="num"></span>
</div>
And I have the following script
$( document ).ready( function() {
$( '#master > span.num' ).click( function() {
q = $( "span[id*=num-']" ).attr( "id" );
$( '#master' ).html( ' ' ).load( 'www.someurl.com/?rating=' + q );
});
});
The load function returns a completely new set of span elements for inside the div. Problem is that I can’t seem to figure out how to get this to work past the first time I click one. Since the click is tied to the spans and the spans get replaced, I understand that they no longer have a script tied to them, but I haven’t been able to figure out how to get this to re-tie on the fly. I’m super new to jquery and javascript so any help would be appriciated.
All my experiments with using .live() have merely rendered my script useless. Help?
EDITED: as suggested by Beejamin
I suppose you are trying to do a rating system? just for sake my
PHPfile look like this: