my requirement is based on group of checkbox checks shipping address fields will be disable or enabled.
make clear my requirement:Wicket id:"nonDigital" having 6 check boxes.if any one of check box is checked then only shipping address section is enabled and then only user can enter value.
Here is my code
My HTML code:
<fieldset class="deliveryFormats">
<h2 class="sectionHeading">Delivery Formats</h2>
<span class="required">* Required Field</span>
<br/>
<div class="leftDiv">
<label>Non-digital</label>
<div class="radioLabel" wicket:id="nonDigital" >
<label>
<input class="checkbox" type="checkbox" name="formatType" />Beta SP NTSC
</label>
</div><!-- /.radioLabel non digital -->
</fieldset>
<fieldset class="shippingAddress" style="border-bottom: 0px;" >
<h2 class="sectionHeading">Shipping Address</h2>
<table class="form">
<tbody>
<tr>
<th class="fieldName" scope="row">Company</th>
<td class="fieldEdit">
<input class="organization" type="text" wicket:id="address.organization"/>
</td>
</tr>
<tr>
<th class="fieldName" scope="row">Address 1</th>
<td class="fieldEdit">
<input class="long" type="text" wicket:id="address.line1">
</td>
</tr>
<tr>
<th class="fieldName" scope="row">Address 2</th>
<td class="fieldEdit">
<input class=" long" type="text" wicket:id="address.line2">
</td>
</tr>
<tr>
<th class="fieldName" scope="row">Address 3</th>
<td class="fieldEdit">
<input class="long" type="text" wicket:id="address.line3">
</td>
</tr>
<tr>
<th class="fieldName" scope="row">City</th>
<td class="fieldEdit">
<input class="long" type="text" wicket:id="address.city"/>
</td>
</tr>
<tr>
<th class="fieldName" scope="row">State</th>
<td class="fieldEdit">
<input class="long" type="text" wicket:id="address.state"/>
</td>
</tr>
<tr>
<th class="fieldName" scope="row">Postal Code</th>
<td class="fieldEdit">
<input class="postalcode" type="text" wicket:id="address.postalCode"/>
</td>
</tr>
</tbody>
</table>
Java code:
List<DeliveryFormat> formatChoices = lookupProcessor.getLookupValues(DeliveryFormat.class);
List<DeliveryFormat> nonDigital = new ArrayList<DeliveryFormat>();
List<DeliveryFormat> digital = new ArrayList<DeliveryFormat>();
Iterator<DeliveryFormat> nondigitalIterator = formatChoices.iterator();
while(nondigitalIterator.hasNext()){
DeliveryFormat df = nondigitalIterator.next();
if(df.getLabel().equals("Audio Bundle") || df.getLabel().equals("XDCAM file")|| df.getLabel().equals("FTP")){
digital.add(df);
}
else
{
nonDigital.add(df);
}
}
//Add the check boxes for Delivery format for digital List
// add(new CheckBoxMultipleChoice<DeliveryFormat>("nonDigital", nonDigital, new ChoiceRenderer<DeliveryFormat>("label")));
ChoiceRenderer<DeliveryFormat> deliveryFormatShippment = new ChoiceRenderer<DeliveryFormat>("label", "id");
CheckBoxMultipleChoice<DeliveryFormat> nonDigitalDelivery = new CheckBoxMultipleChoice<DeliveryFormat>(
"nonDigital", nonDigital, deliveryFormatShippment);
CheckBoxMultipleChoice<DeliveryFormat> digitalDelivery = new CheckBoxMultipleChoice<DeliveryFormat>(
"digital", digital, deliveryFormatShippment);
add(nonDigitalDelivery);
/*final CheckBox test = new CheckBox("nonDigital");
test.setOutputMarkupId(true);
nonDigitalDelivery.add(new AjaxEventBehavior("onKeyUp")
{
*//**
*
*//*
private static final long serialVersionUID = 1L;
#Override
protected void onEvent(AjaxRequestTarget target) {
// TODO Auto-generated method stub
test.setEnabled(false);
target.addComponent(test);
}
});*/
You should try to enable the markupid to be written:
textArea.setOutputMarkupId(true);
and then add this component to the target:
textArea.setEnabled(false):
target.add(textArea);
Related
I'm trying to iterate through an HTML table to get values from it, but I do not get the desired results. This is the HTML code:
<div class="o_sale_order table-responsive">
<table class="o_list_view table table-sm table-hover table-striped o_list_view_ungrouped">
<thead>
<tr>
<th width="1" class="o_list_record_selector">
<div class="custom-control custom-checkbox">
<input type="checkbox" id="checkbox-868" class="custom-control-input">
<label for="checkbox-868" class="custom-control-label"></label></div>
</th>
<th class="o_column_sortable" data-original-title="" title="">Quotation Number</th>
<th class="o_column_sortable" data-original-title="" title="">Quotation Date</th>
<th class="o_column_sortable" data-original-title="" title="">Customer</th>
<th class="o_column_sortable" data-original-title="" title="">Salesperson</th>
<th class="o_column_sortable" style="text-align: right;" data-original-title="" title="">Total</th>
<th class="o_column_sortable" data-original-title="" title="">Status</th>
</tr>
</thead>
<tbody class="ui-sortable">
<tr class="o_data_row">
<td width="1" class="o_list_record_selector">
<div class="custom-control custom-checkbox">
<input type="checkbox" id="checkbox-869" class="custom-control-input">
<label for="checkbox-869" class="custom-control-label"></label></div>
</td>
<td class="o_data_cell o_readonly_modifier o_required_modifier">SO107</td>
<td class="o_data_cell o_required_modifier">03/04/2019 17:40:46</td>
<td class="o_data_cell o_required_modifier">AA</td>
<td class="o_data_cell">Administrator</td>
<td class="o_data_cell o_list_number o_monetary_cell o_readonly_modifier">
<span class="o_field_monetary o_field_number o_field_widget o_readonly_modifier" name="amount_total">305.00 €</span></td>
<td class="o_data_cell o_readonly_modifier">Quotation Sent</td>
</tr>
<tr class="o_data_row">
<td width="1" class="o_list_record_selector">
<div class="custom-control custom-checkbox">
<input type="checkbox" id="checkbox-870" class="custom-control-input">
<label for="checkbox-870" class="custom-control-label"></label></div>
</td>
<td class="o_data_cell o_required_modifier">SO055</td>
<td class="o_data_cell o_required_modifier">03/01/2019 20:24:35</td>
<td class="o_data_cell o_required_modifier">AA</td>
<td class="o_data_cell">Administrator</td>
<td class="o_data_cell o_list_number o_monetary_cell o_readonly_modifier">
<span class="o_field_monetary o_field_number o_field_widget o_readonly_modifier" name="amount_total">2.44 €</span></td>
<td class="o_data_cell o_readonly_modifier">Quotation</td>
</tr>
<tr class="o_data_row">
<td width="1" class="o_list_record_selector">
<div class="custom-control custom-checkbox"><input type="checkbox" id="checkbox-871" class="custom-control-input">
<label for="checkbox-871" class="custom-control-label"></label></div>
</td>
<td class="o_data_cell o_required_modifier">SO039</td>
<td class="o_data_cell o_required_modifier">03/01/2019 12:16:08</td>
<td class="o_data_cell o_required_modifier">AA</td>
<td class="o_data_cell">Administrator</td>
<td class="o_data_cell o_list_number o_monetary_cell o_readonly_modifier">
<span class="o_field_monetary o_field_number o_field_widget o_readonly_modifier" name="amount_total">2.44 €</span></td>
<td class="o_data_cell o_readonly_modifier">Quotation</td>
</tr>
<tr class="o_data_row">
<td width="1" class="o_list_record_selector">
<div class="custom-control custom-checkbox">
<input type="checkbox" id="checkbox-872" class="custom-control-input">
<label for="checkbox-872" class="custom-control-label"></label></div>
</td>
<td class="o_data_cell o_required_modifier">SO025</td>
<td class="o_data_cell o_required_modifier">02/28/2019 19:50:59</td>
<td class="o_data_cell o_required_modifier">BB</td>
<td class="o_data_cell">Administrator</td>
<td class="o_data_cell o_list_number o_monetary_cell o_readonly_modifier">
<span class="o_field_monetary o_field_number o_field_widget o_readonly_modifier" name="amount_total">2.44 €</span></td>
<td class="o_data_cell o_readonly_modifier">Quotation</td>
</tr>
</tbody>
<tfoot>
<tr>
<td></td>
<td class="name"></td>
<td class="date_order"></td>
<td class="partner_id"></td>
<td class="user_id"></td>
<td class="amount_total o_list_number" title="Total Tax Included">312.32</td>
<td class="state"></td>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</main>
</div>
I need to get from each row the value starting with "SO", like this:
<td class="o_data_cell o_required_modifier">SO055</td>
I tried with:
List<String> list = new ArrayList<>();
driver.findElement(By.xpath("//*[#class = 'o_dropdown_toggler_btn btn btn-secondary dropdown-toggle' and (contains(text(), 'Filters') or contains(., 'Filters'))]")).click();
driver.findElement(By.xpath("(//a[contains(text(),'Quotations')])[2]")).click();
driver.findElement(By.xpath("//*[#class = 'o_dropdown_toggler_btn btn btn-secondary dropdown-toggle' and (contains(text(), 'Filters') or contains(., 'Filters'))]")).click();
List<WebElement> rows = driver.findElements(By.xpath("//table[#class='o_list_view table table-sm table-hover table-striped o_list_view_ungrouped']//tr[not(th)]"));
Iterator<WebElement> iter = rows.iterator();
while(iter.hasNext()) {
WebElement tr = iter.next();
WebElement td = tr.findElement(By.xpath("./td[(#class='o_data_cell o_readonly_modifier o_required_modifier')]"));
listaPreventiviFatturabili.add(td.getText());
}
but it doesn't work.
This is a screenshot of the webpage in question:
Can you help me?
Another question: How can I wait for the page to load after I select the Filter for "Quotations"?
try this xpath. It will return all cells containing SO value
By.xpath("//table//td[contains(text(),'SO')]");
List<WebElement> rows = driver.findElements(By.xpath("//table//td[contains(text(),'SO')]"));
You can directly find all table cell in the first column where the SOxxx insides.
List<WebElement> first_cloumns = driver.findElements(
By.cssSelector("div.o_sale_order tbody td:nth-child(1)"));
List<String> values = first_cloumns
.stream() // require JDK 8 and higher
.map(td -> td.getText())
.collect(Collectors.toList());
index.scala.html
#(form: Form[applicationmodel.ApplicationModel])
#if(form.hasErrors) {
#for((key, value) <- form.errors) {
<p>#value(0).message</p>
}
} else {
<form action="/search" method="GET">
<label class="search-label">ID</label>
<input type="text" name="empId" id="empId" value="#(form.get().empId)"/>
<label class="search-label">HIRE DATE</label>
<input type="text" name="hireDateFrom" id="hireDateFrom" value="#(form.get().hireDateFrom)" autocomplete="off"/>
<div id="curly-dash">~</div>
<input type="text" name="hireDateTo" id="hireDateTo" value="#(form.get().hireDateTo)" autocomplete="off"/>
<br>
<label class="search-label">FIRST NAME</label>
<input type="text" name="firstName" id="firstName" value="#(form.get().firstName)"/>
<label class="search-label">MANAGER</label>
<input type="text" name="managerName" id="managerName" value="#(form.get().managerName)"/>
<br>
<div>
<label class="search-label">LAST NAME</label>
<input type="text" name="lastName" id="lastName" value="#(form.get().lastName)"/>
<input type="image" src="#routes.Assets.at("images/BtnSearch.jpg")">
</div>
</form>
</div>
<form action="/addEdit" method="POST" id="list-form">
<table id="table-list">
<caption class="position-relative">
<img src="#routes.Assets.at("images/Search.jpg")" id="btn-search" class="btn-size">
<h1 class="inline-block">Employee Records</h1>
<img src="#routes.Assets.at("images/Add.jpg")" id="btn-add" class="btn-size">
</caption>
<thead>
<tr>
<th class="solid-green-border column-title">EMPLOYEE_ID</th>
<th class="solid-green-border column-title">FIRST NAME</th>
<th class="solid-green-border column-title">LAST NAME</th>
<th class="solid-green-border column-title">EMAIL</th>
<th class="solid-green-border column-title">PHONE NUMBER</th>
<th class="solid-green-border column-title">HIRE DATE</th>
<th class="solid-green-border column-title">JOB</th>
<th class="solid-green-border column-title">SALARY</th>
<th class="solid-green-border column-title">COMMISSION_PCT</th>
<th class="solid-green-border column-title">DEPARTMENT</th>
<th class="solid-green-border column-title">MANAGER</th>
<th class="solid-green-border column-title">ACTION</th>
</tr>
</thead>
<tbody>
#for(item <- form.get().emplist) {
<tr>
<td class="solid-green-border column-content">#item.employeeId</td>
<td class="solid-green-border column-content">#item.firstName</td>
<td class="solid-green-border column-content">#item.lastName</td>
<td class="solid-green-border column-content">#item.email</td>
<td class="solid-green-border column-content">#item.phoneNo</td>
<td class="solid-green-border column-content">
<div class="position-relative">
<span class="class-hiredate">#item.displayHiredate</span>
<input type="image" src="/assets/images/imgDate.jpg" class="icon-size date" disabled>
</div>
</td>
<td class="solid-green-border column-content">#item.job.jobTitle</td>
<td class="solid-green-border column-content">#item.displaySalary</td>
<td class="solid-green-border column-content">#item.commission</td>
<td class="solid-green-border column-content department">#item.deptName</td>
<td class="solid-green-border column-content">#item.managerName</td>
<td class="solid-green-border column-content">
<input type="image" src="#routes.Assets.at("images/Edit.jpg")" class="icon-size edit"></td>
</tr>
}
</tbody>
</table>
<input type="image" src="#routes.Assets.at("images/BtnSave.jpg")" id="btn-save">
</form>
}
What syntax should i use to access the form again during bad request and get that emplist,form.get() is of no use whenever it is in bad request it seems like the form itself is not the same during index
Controller
Index
#Transactional
public static Result index() {
System.out.print("asdf");
appModel = new ApplicationModel();
Form<ApplicationModel> form =
Form.form(ApplicationModel.class).fill(appModel.init(appModel));
return ok(index.render(form));
}
Controller
upon submitting i wish to display it all again as is when i submit it with errors,i can only display as of now errors not retain its values
#Transactional
public static Result addEdit() {
Form<ApplicationModel> form =
Form.form(ApplicationModel.class).bindFromRequest();
if (form.hasErrors()) {
return badRequest(index.render(form));
}
form.get().update();
ApplicationModel newAppModel = new ApplicationModel();
form = Form.form(ApplicationModel.class).fill(newAppModel.init(newAppModel));
return ok(index.render(form));
}
Solution: After many trial and errors
Enclose it with this and access the specific value you want to achieve
#for(i <- 0 to {form("emplist").indexes.size.toInt} - 1) {
}
*I personally hope this would help future generations using play framework to help them accessing forms values with iteration :) *
I want to click a text related input with preceding-sibling node my HTML is the following:
<FORM id="formid" onsubmit="" method=post name="formid" action=>
<TABLE width="100%">
<TR class=foo-even>
<TD rowSpan=3><INPUT onclick="" value=1 type=radio name="formid">upbutton1</TD>
<TD>Pearl</TD>
<TD rowSpan=3></TD>
</TR>
<TR class=foo-even>
<TD>ravenclawn</TD>
</TR>
<TR class=foo-even>
<TD>ravenclawn</TD>
</TR>
</TBODY>
</TABLE>
</TD></TR>
<TR>
<TD> </TD>
</TR>
</TBODY></TABLE>
<TABLE width="100%" >
<TBODY>
<TR>
<TD class="someclass"></TD>
</TR>
<TR>
<TD>
<TABLE class=foo width="100%" border="1px">
<TBODY>
<TR class=foo-header>
<TD></TD>
<TD><BR></TD>
<TD colSpan=3></TD>
<TD></TD>
</TR>
<TR class=foo-odd>
<TD><INPUT value=0 type=radio name="formid.samename">buttonclick1</TD>
<TD>1234</TD>
<TD>blue </TD>
<TD colSpan=2>apple2</TD>
<TD> <INPUT value=0 type=hidden name="samenameagain"></TD>
</TR>
<TR class=foo-even>
<TD><INPUT value=1 type=radio name="formid.samename">buttonclick2</TD>
<TD>1235 </TD>
<TD>blue </TD>
<TD colSpan=2>apple3</TD>
<TD> <INPUT value=0 type=hidden name="samenameagain"> </TD>
</TR>
<TR class=foo-odd>
<TD><INPUT value=2 type=radio name="formid.samename">buttonclick3</TD>
<TD>1235</TD>
<TD>sometext </TD>
<TD>Pearl</TD>
<TD></TD>
<TD> <INPUT value=0 type=hidden name="samenameagain"> </TD>
</TR>
<TR class=foo-even>
<TD><INPUT value=3 type=radio name="formid.samename">buttonclick4</TD>
<TD>1236 </TD>
<TD>blue </TD>
<TD colSpan=2>apple4</TD>
<TD> <INPUT value=0 type=hidden name="samenameagain"> </TD>
</TR>
<TR class=foo-odd>
<TD><INPUT value=4 type=radio name="formid.samename">buttonclick5</TD>
<TD>1236 </TD>
<TD>sometext </TD>
<TD>ravenclawn</TD>
<TD></TD>
<TD> <INPUT value=0 type=hidden name="samenameagain"> </TD>
</TR>
<TR class=foo-even>
<TD><INPUT value=5 type=radio name="formid.samename">buttonclick6</TD>
<TD>1237 </TD>
<TD>blue </TD>
<TD colSpan=2>apple6</TD>
<TD> <INPUT value=0 type=hidden name="samenameagain"> </TD>
</TR>
<TR class=foo-odd>
<TD><INPUT value=6 type=radio name="formid.samename">buttonclick7</TD>
<TD>1237 </TD>
<TD>sometext </TD>
<TD>ravenclawn</TD>
<TD></TD>
<TD> <INPUT value=0 type=hidden name="samenameagain"></tD>
</DIV>
My target is to click on second Pearl text related input field
Selenium code is the following:
driver.findElement(By.xpath(".//td[contains(text(),'Pearl')][1]/preceding-sibling::td")).click();
Problem:
Above code always working with first table that contains Pearl text
Observations:
That case when im modify first Pearl text to something else the code working fine
That case when im working with another text ect:"ravenclawn" its working fine without any modifications
Thanks for any advice
You just include index for table also.
For 1st table
By.xpath("//table[1]//td[contains(text(),'Pearl')]/preceding-sibling::td")
For 2nd table
By.xpath("//table[2]//td[contains(text(),'Pearl')]/preceding-sibling::td")
I want to upload details of a hoarding in mysql database with an image using .jsp and servlet but when i call my servlet it gives a blank page..
My .jsp
<form action="HoardingProfile" method="post" enctype="multipart/form-data">
<table style="height: 100%; width:100%;">
<tr style="height: 10%;">
<td class="tdleft" style="width: 50%;">
<h3>Location</h3>
</td>
<td style="width: 50%;">
<input type="text" class="tx bk" name="txtLocation"
placeholder="Location" required="yes">
</td>
</tr>
<tr style="height: 02%">
<td>
</td>
</tr>
<tr style="height: 10%;">
<td class="tdleft" style="width: 50%;">
<h3>Size</h3>
</td>
<td class="padd10" style="width: 50%;">
<input class="tx bk" type="text" name="txtSize" placeholder="Size"
required="yes">
</td>
</tr>
<tr style="height: 02%">
<td>
</td>
</tr>
<tr style="height: 10%;">
<td class="tdleft" style="width: 50%;">
<h3>Owner Name</h3>
</td>
<td style="width: 50%;">
<input type="text" class="tx bk" placeholder="Owner Name"
required="yes" name="txtName">
</td>
</tr>
<tr style="height: 02%">
<td>
</td>
</tr>
<tr style="height: 10%;">
<td class="tdleft" style="width: 50%;">
<h3>Contact No.</h3>
</td>
<td style="width: 50%;">
<input type="text" class="tx bk" placeholder="Number"
required="yes" name="txtNumber">
</td>
</tr>
<tr style="height: 02%">
<td>
</td>
</tr>
<tr style="height: 10%;">
<td class="tdleft" style="width: 50%;">
<h3>Address</h3>
</td>
<td style="width: 50%;">
<textarea class="tx bk2" placeholder="Address" required="yes"
name="txtAddress"></textarea>
</td>
</tr>
<tr style="height: 02%">
<td>
</td>
</tr>
<tr style="height: 15%;">
<td class="tdleft" style="width: 50%;">
<h3>Picture</h3>
</td>
<td style="width: 50%;">
<input type="file" name="file" id="file">
</td>
</tr>
<tr style="height: 02%">
<td>
</td>
</tr>
<tr style="height: 10%;">
<td class="tdleft" style="width: 50%;">
<h3>Google map</h3>
</td>
<td style="width: 50%;">
<textarea class="tx bk2" placeholder="Google Map iframe"
name="txtMap"></textarea>
</td>
</tr>
<tr style="height: 02%">
<td>
</td>
</tr>
<tr style="height: 10%;">
<td class="tdleft" style="width: 80%;">
<input class="btn" type="submit" name="Add" value="Save"
</td>
<td style="width: 20%;">
<input class="btn" type="reset" value="Reset"
</td>
</tr>
</table>
</form>
and my servlet
PrintWriter out = response.getWriter();
try {
// Apache Commons-Fileupload library classes
DiskFileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload sfu = new ServletFileUpload(factory);
if (! ServletFileUpload.isMultipartContent(request)) {
System.out.println("Sorry. No file uploaded");
return;
}
// parse request
List<FileItem> items = sfu.parseRequest(request);
out.print(items);
FileItem txtLocation = (FileItem) items.get(0);
String location = txtLocation.getString();
out.println(location);
FileItem txtSize = (FileItem) items.get(1);
String size = txtSize.getString();
out.println(size);
FileItem txtName = (FileItem) items.get(2);
String name = txtName.getString();
out.println(name);
FileItem txtNumber = (FileItem) items.get(3);
String number = txtNumber.getString();
out.println(number);
FileItem txtAddress = (FileItem) items.get(4);
String address = txtAddress.getString();
out.println(address);
// get uploaded file
FileItem file = (FileItem) items.get(5);
// Connect to Oracle
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/opm?zeroDateTimeBehavior=convertToNull","root","");
con.setAutoCommit(false);
PreparedStatement ps = con.prepareStatement("insert into hprofile(location,size,owner,address,phone,deleted,img) values(?,?,?,?,?,?,?)");
ps.setString(1, location);
ps.setString(2, size);
ps.setString(3, name);
ps.setString(4, number);
ps.setString(5, address);
// size must be converted to int otherwise it results in error
ps.setBinaryStream(6, file.getInputStream(), (int) file.getSize());
ps.executeUpdate();
con.commit();
con.close();
out.println("Proto Added Successfully. <p> <a href='listphotos'>List Photos </a>");
}
catch(Exception ex) {
out.println( "Error --> " + ex.getMessage());
}
finally {
out.close();
}
I found out that I made some mistakes while linking the libraries...
I have a table as follows
<table id="vainTbl6" class="dtable" cellpadding="3" cellspacing="1" border="0">
<thead>
<tr><th>check</td><th>Morphosal</th><th>goat </th><th>the other</th></tr>
</thead>
<tbody id="tbdy">
<tr class="gradeX">
<td><input type="checkbox" class = "chcktbl" /></td>
<td style="width:55%">-Approve the femuneration Gommiqee purpirt</td>
<td>pontpose</td></tr>
<tr class="gradeX">
<td><input type="checkbox" class = "chcktbl" /></td>
<td style="width:55%">-Declare a final truce</td>
<td>More</td></tr>
<tr class="gradeX"><td><input type="checkbox" class = "chcktbl" /></td>
<td style="width:55%">-Amend the articles of asscotonation</td>
<td>Four</td></tr>
<tr class="gradeX"><td><input type="checkbox" class = "chcktbl" /></td>
<td style="width:55%">-Re-elect Bandanna la banana for warden</td>
<td>Floor</td></tr>
</tbody>
</table>
and the first column is a checkbox. I need to fetch all the second column cells where the checkbox in the first column is set to true
I tried using this, but to no avail.
function extractRowCell(divNode){
alert(divNode.id);
$('#tbdy tr td').each(function() {
alert('hello');
var aRowData = this.cells
alert(aRowData[1].firstChild.value);
return aRowData;
});
}
The call is as follows:
<a id="la" href='#' onclick='extractRowCell(this.parentNode)' style="position:absolute; top:280px; left:350px;">Votes & Concerns</a>
The alert in the function triggers though with the correct value.
TIA
To iterate over the td's simply do the following.
$('#tbdy tr td').each(function() {
alert( $(this).text() );
});
You can do this
<table><tbody id="tbdy">
<tr class="gradeX">
<td><input type="checkbox" class = "chcktbl" /></td>
<td style="width:55%" class="item">-Approve the femuneration Gommiqee purpirt</td>
<td>pontpose</td></tr>
<tr class="gradeX">
<td><input type="checkbox" class = "chcktbl" /></td>
<td style="width:55%" class="item">-Declare a final truce</td>
<td>More</td></tr>
<tr class="gradeX"><td><input type="checkbox" class = "chcktbl" /></td>
<td style="width:55%" class="item">-Amend the articles of asscotonation</td>
<td>Four</td></tr>
<tr class="gradeX"><td><input type="checkbox" class = "chcktbl" /></td>
<td style="width:55%" class="item">-Re-elect Bandanna la banana for warden</td>
<td>Floor</td></tr>
</tbody>
</table>
<button>Get</button>
<script>
$("button").click(function(){
var ret="";
$("#tbdy tr td:first").each(function()
{
if($("input:checked").length!=0)
{
ret=$("input:checked").parent().parent().find("td.item").text();
}
});
alert(ret);
});
</script>