Select the first checkbox?

0 like 0 dislike
4 views
There is such code:
<_tr class="table_rows">

<_td><_input name="del[{$item->id}]" type="checkbox" id="del[{$item->id}]" value="1">



<_td>

<_input name="test" type="text" id="test" value="123" size="60">

<_/td>


<_td>

text

<_/td>

<_/ tr>



The above code is used to output the list of documents, clicking on them line by line must be placed in the checkbox. The problem is that when you click on other checkboxes, links or input fields the first checkbox is selected. How to make limit?

$('.table_rows').click(function() {
$(this).toggleClass("selects");

if( $(this).find("input").is(":checked"))
{
$(this).find("input").removeAttr("checked");
} else {
$(this).find("input").attr("checked","checked");
}

});
by | 4 views

5 Answers

0 like 0 dislike
Maybe you forgot to put?
\r
Something I didn't understood your question.
by
0 like 0 dislike
<_input type="checkbox" id="vasid" value="1"/>
\r
your text
by
0 like 0 dislike
sorry for this laburda. just forget that there are html tags. So, final answer:
\r
\r<_input type="checkbox" id="vasid" value="1"/>
\r<_label for="vasid">your text for your checkbox<_/label>
by
0 like 0 dislike
Don't understand the question, but something from this approach? )
\rjsfiddle.net/4k6PA/7/
by
0 like 0 dislike
Events in jquery are activated during the "ascent" (in addition to event focus, and perhaps for certain other browsers, because IE does not support "capture" in their version <9).
Based on this you can activate the checkbox while clicking on the row and the second time if the event will vsplyvet to the link / the text field.
Well deliveryvalium makes sense this event on the entire table hung. And next time make your fine question and learn some js, for challenging/interesting in the SIM nothing :).
by

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
2 answers
0 like 0 dislike
2 answers
0 like 0 dislike
1 answer
110,608 questions
257,186 answers
0 comments
1,120 users