It will look like this:
$("[id^=content]").click(function(event){
$("#show").val($("#" + this.id.replace('content', 'hidden')).val());
});
. , start-with selector ([attr^=value]), ( .class). , 'content' 'hidden' string.replace() . .val(value), .val() = value :)
, , , <input type="hidden" /> <span> :
$("[id^=content]").click(function(event){
$("#show").val($(this).next().val());
});
, , , , , :
<div id="test22">
<span id="content22" class="clickable">Click to add the value</span>
<input type="hidden" id="hidden22" value="hello">
</div>
<div id="test33">
<span id="content33" class="clickable">Click to add the value</span>
<input type="hidden" id="hidden33" value="world">
</div>
<input type="text" id="show">
jQuery:
$(".clickable").click(function(event){
$("#show").val($(this).next().val());
});