Hi I'm new to PHP and Jquery! Please look at the codes first, my question follows.
HTML + PHP code:
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">× </button>
<h4 class="modal-title" id="myModalLabel">Add new Project</h4>
</div>
<div class="modal-body">
<p class="validateTips">Select a Project</p>
<div id="start">
<?php
foreach($data as $list_proj) {
?>
<a><p class="padd" id="<?php echo 'padd'.$list_proj->mlist_id;?>"><u><?php echo $list_proj->proj_title ?></u></p></a>
<input type="text" name="hide_id" id="<?php echo 'hide_id'.$list_proj->mlist_id;?>" class="hide_id" value="<?php echo $list_proj->mlist_id ?>" />
<?php
}
?>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary" id="save">Save changes</button>
</div>
</div>
The above code creates a list of project titles that comes from the database inside the modal.
JQUERY code:
<script>
$(window).load(function() {
$("#hideito").hide();
});
$(document).ready(function(){
$(".padd").click(function(){
var value = $("#hide_id1").val();
$(".hide_nayan").val(value);
$("#hideito").show();
$("#myModal").modal("hide" );
});
});
</script>
The above code must select the specific list that is clicked. Now my question is, how do I get the specific value from the textboxes created in the modal then pass it to another textbox in the page? I have set their ids with "hide_id" + their respective id from the database, but they share a common class name.