Please remember to click “Mark as Answer” on the post that helps you and to unmark it if a marked post does not actually answer your question.
Thank you!
----------------------
"Microsoft Community Contributor Award 2011"
prev() navigates siblings. Your input is in a td, so you need to go to parent td, it's prev() and back down to input. $(this).closest('td').prev().find('input').val();
bruce (sqlwork.com)
Marked as answer by rlowe7117 on Aug 08, 2012 12:08 PM
rlowe7117
Member
240 Points
72 Posts
Using Prev() for value of textbox
Aug 07, 2012 07:08 PM|LINK
how do I get the value of the text box using Jquery Prev(). I am getting undefined in alert box.
$("#<%=txt_D_EBITDA_Actual.ClientID%>").focusout(function() { var a = $(this).val(); var b = $(this).prev().val(); alert(b);santa_1975
Star
8574 Points
1499 Posts
Re: Using Prev() for value of textbox
Aug 07, 2012 11:31 PM|LINK
Hi,
Try this code.
$(this).prevAll('input').val()Hope this helps.
Thank you!
----------------------
"Microsoft Community Contributor Award 2011"
bruce (sqlwo...
All-Star
36882 Points
5451 Posts
Re: Using Prev() for value of textbox
Aug 08, 2012 02:43 AM|LINK
rlowe7117
Member
240 Points
72 Posts
Re: Using Prev() for value of textbox
Aug 08, 2012 12:08 PM|LINK
thanks for you help. Saved me tons of work.
asteranup
All-Star
30184 Points
4906 Posts
Re: Using Prev() for value of textbox
Aug 08, 2012 05:08 PM|LINK
Hi,
You can try this also -
$(this).closest("tr").find("input[id*=txt_D_EBITDA_Budget]").val()Anup Das Gupta
Mark as Answer if you feel so. Visit My Blog