Jquery find cell containing Checkbox by class name on same row -


Hi all and thanks in advance,

I'm looking at some articles using Jquery How to find the elements, but none of the changes that I have made, none of them are working. So what I am trying to achieve here, I have a gridview that has a link button that can be clicked and a check box that is wrapped in a partition with the class name. When the link button is clicked, it calls it like a jazzery function:

The function itself is:

  RemovePerson (lnk, id) {// Find the checkbox here and uncheck it}   <<>  <<>  var cb = $ (this) .closest ('.blblox'). ('Input [type =' checkbox "] '); Var cb = $ (this) .find ('.blblox & gt; input [type = "checkbox"]'); Var cb = $ (this). Parent (). ('Td: last-child input [type = "checkbox"]'); If I try to use 'LNK' instead of $ (this) then breaks the page, so I'm not sure my problem is that I'm passing 'this wrong' or I'm closest to I am using or looking for all of the above wrongly or above. What is the correct way to fix the check box on this one line?  

Update: This is the markup of the rendered gridview.

  & lt; Table class = "table format fixed width" cellspacing = "0" rule = "all" range = "1" id = "gvPOCWarden" style = "border-fall: collapse;" & gt; & Lt; TR & gt; & Lt; Th scope = "colonel" & gt; & Amp; Nbsp; & Lt; / Th & gt; & Lt; Th scope = "colonel" & gt; Name & lt; / Th & gt; & Lt; Th scope = "colonel" & gt; Id & lt; / Th & gt; & Lt; Th scope = "call" & gt; Phone & lt; / Th & gt; & Lt; Th scope = "colonel" & gt; Email & lt; / Th & gt; & Lt; Th scope = "colonel" & gt; Email & lt; / Th & gt; & Lt; Th scope = "colonel" & gt; Add Role & lt; / Th & gt; & Lt; / TR & gt; & Lt; TR & gt; & Lt; Td align = "center" & gt; & Lt; One onclick = "RemoveProttern (this, & amp; # 39; RWBB / TFYFU = & amp; # 39;);" Id = "lnkRemove" href = "javascript: __ doPostBack (& ​​amp; # 39; ctl00 $ ctl00 $ Master Contact Place $ $ Tabs Main Content Plider $ gvPersons $ ctl02 $ lnk Remove & amp; # 39; & amp; # 39; & # 39;) "style =" color: dead; font-weight: bold; "& gt; X; & Lt; / A & gt; & Lt; / TD & gt; & Lt; Td> 1 name & lt; / Td> & Lt; TD & gt; N42 & lt; / TD & gt; & Lt; TD & gt; 5686698542 & lt; / TD & gt; & Lt; Td> & Lt; Span id = "lblEmail" & gt; Name 1@mail.com< / Span & gt; & Lt; / Td> & Lt; Td align = "center" & gt; & Lt; Div class = "pocBox" & gt;    

I tried to do a jsfiddle setup to test this, but syntax errors Find out which I can not do. So I took the freedom to set a JSfield that removes inline javascript and just takes a jQuery approach -

  $ ('table a'). Click (function () {$ (this) closest ('tr'). ('Td div input: checkbox'). Search ('check', wrong);});   

This is normal and will work for all the rows in the table. Warning: Make sure that all the IDs in your markup are unique, especially if you decide to use them for something, you will get funky results if you decide to use them in a function.

As I said, I removed the inline javascript, but I changed it to a data-id added ID value that was done to call RemovePerson - < / P>

  & lt; Td align = "center" & gt; & Lt; A data-id = "& amp; # 39; RWgB / tFwYfU = & amp; # 39; id =" lnkRemove "href =" # "style =" color: dead; Font-weight: bold; "> x    

I hope it helps please tell me if You have any questions.

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -