Hi all,
I was trying to grab the ID of the SPAN tag when a user clicked it.
Since the ID of each tag contains two digits, they would be used for referring
to the value of their corresponding hidden text box field,
but I am stuck over this question.
Here is part of the code that I have written.
I need your help to finish it because I don't know how to move on.
<script type="text/javascript">
$(document).ready(function(){
$("#^=content").click(function(event){
// var digit = extract the last two digit of the id
var id_of_the_hidden_field = "hidden"+digit;
$("#show").val()=$("#hidden").val();
});
});
</script>
<div id="test22">
<span id="content22">Click to add the value</span>
<input type="hidden" id="hidden22" value="hello">
</div>
<div id="test33">
<span id="content33">Click to add the value</span>
<input type="hidden" id="hidden33" value="world">
</div>
<input type="text" id="show">