<script type="text/javascript" language="javascript">
$(document).ready(function(){
$('#second').click(function(){
$('div#first').html(function(i,v){
return v.replace(/[0-9]+/g,'XYZ9876');
});
alert('Changed');
});
});
</script>
<div id="first">
<div id="second">[edit]</div>
0123
</div>
I'm trying to replace the only text "ABC0123" inside #first and every thing should remain the same like:
<div id="first"> <div id="second">[edit]</div> XYZ9876 </div>
By using above code resolve this problem for first click.
But when i click second or third or more time, click event not working. i have to write such code that clicking on any number of time it should fire the click event. Can anyone suggest me the right way to do this.

New Topic/Question
Reply



MultiQuote



|