This is my html code:
<div class="viewPopup login-popup" id="login-box">
<a href="#" class="close"><img src="images/close.png" class="btn_close" title="Close Window" alt="Close" /></a>
<h6 class="h6">Task Name</h5>
<div class="info">
<p class="name">Assigned to </p>
<p class="cont1"> Kumar</p>
</div>
<div class="info">
<ul>
<li><p class="name">Task </p></li>
<li><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec condimentum est ut dolor aliquam sit amet suscipit urna vehicula. Nunc dolor massa, viverra commodo gravida sed, sodales et metus. Maecenas lacinia facilisis semper. Pellentesque ac tellus lacus.</p></li>
</ul>
</div>
<div class="info">
<p class="name">Starting Date </p>
<p class="cont1"> 19/12/2012</p>
</div>
<div class="info">
<p class="name">Ending Date </p>
<p class="cont1"> 22/12/2012</p>
</div>
</div>
<a href="#login-box" class="login-window" title="View">
<input type="text" name="review_id" id="review_id" value="10" />
<img src="images/eye.png" >
</a>
<a href="#login-box" class="login-window" title="View">
<input type="text" name="review_id_txt" id="review_id_txt" value="10" />
<img src="images/eye.png" >
</a>
This is my jquery code:
// JavaScript Document
$(document).ready(function() {
$('a.login-window').click(function() {
//Getting the variable's value from a link
var loginBox = $(this).attr('href');
//Fade in the Popup
$(loginBox).fadeIn(300);
//Set the center alignment padding + border see css style
var popMargTop = ($(loginBox).height() + 24) / 2;
var popMargLeft = ($(loginBox).width() + 24) / 2;
$(loginBox).css({
'margin-top' : -popMargTop,
'margin-left' : -popMargLeft
});
// Add the mask to body
$('body').append('<div id="mask"></div>');
$('#mask').fadeIn(300);
return false;
});
// When clicking on the button close or the mask layer the popup closed
$('a.close, #mask').live('click', function() {
$('#mask , .login-popup').fadeOut(300 , function() {
$('#mask').remove();
});
return false;
});
});
Here i want to get the text box value in that jquery code.
That means there have a textbox review_id which is included in the <a></a> tag.
So i want to get the textbox value by using this ` tag.
I know to this code:
$("#review_id").val();
But i actually get text box value based on that <a>.
How can i do this?
Is it possible?
EDIT:
<?php for($i=0;$i<5;$i++){?>
<a href="#login-box" class="login-window" title="View">
<input type="text" name="review_ids" id="review_<?php echo $i;?>" value="<?php echo $i;?>" />
<img src="images/eye.png" >
</a>
This creates 5 <a>tags and 5 textboxes.Then how can i get the review_ids text box value…
Try like this: