[jQuery] automatic way to get click function to work

[jQuery] automatic way to get click function to work


Hi
At the Moment I build the click functions with php, because its easy.
But I would like to know if anybody has an idea for building it
automatically with javascript.
$("#historytext0link").click(function(){
            tinyMCE.execCommand( "mceSetContent",false, $
("#historytext0").html() );
            return false;
        });
            $("#historytext1link").click(function(){
            tinyMCE.execCommand( "mceSetContent",false, $
("#historytext1").html() );
            return false;
        });
            $("#historytext2link").click(function(){
            tinyMCE.execCommand( "mceSetContent",false, $
("#historytext2").html() );
            return false;
        });
            $("#historytext3link").click(function(){
            tinyMCE.execCommand( "mceSetContent",false, $
("#historytext3").html() );
            return false;
        });
html looks like:
<div id="historypanel">
    <div><strong>2007-10-05 16:50:12</strong></div>
    <div id="historytext0">

<a href="#">test1</a>


&nbsp;b


&nbsp;a


&nbsp;a


&nbsp;


c&nbsp;


</div>
    <div><input value="set text" id="historytext0link" class=""
type="button"></div>
</div>
thx
zeek