Loading...
Copy code
Close
Permalink
Close
Please tell us why you want to mark the subject as inappropriate.
(Maximum 200 characters)
Report Inappropriate
Cancel
Private Message
From :
guest
To :
Subject :
Content :
Type the characters you see in the picture below.
Send
Cancel
From :
guest
To :
Subject :
Content :
Type the characters you see in the picture below.
Send
Update
Cancel
Feedback
Email ID
Subject :
Comments :
Send
Cancel
Private Message
Type the characters you see in the picture below.
Type the characters you see in the picture below.
Attach files
Desktop
Google Docs
Each Attachment size should not exceed 1.0 MB.
Max no of attachments : 3
Loading User Profile...
guest
Response title
This is preview!
Attachments
Publish
Back to edit
Cancel
(
)
Sign In
New to this Portal? Click here to
Sign up
You can also use the below options to login
Login with Facebook
Login with Google
Login with Yahoo
jQuery
Plugins
UI
Meetups
Forum
Blog
About
Donate
All Forums
Recent Posts
Log In
Search
jQuery
Search
jQuery Forum
Move this topic
Forum :
Getting Started
Using jQuery
Using jQuery Plugins
Using jQuery UI
Developing jQuery Core
Developing jQuery Plugins
Developing jQuery UI
QUnit and Testing
About the jQuery Forum
jQuery Conferences
jQuery Mobile
Developing jQuery Mobile
Sub forum :
Move this topic
Cancel
Using jQuery
vito
select the right image
in
Using jQuery
•
9 months ago
Hi, I have a table with n rows
this is an example of row
<tr>
<td>
<div>
<img class="deleteimage" src="' . $image . '" />
<a href='' class='trash2'>
<i class='glyphicon glyphicon-trash'></i>
</a>
</div>
</td>
<td>
<input type='checkbox' " . $chk . "> <b>Copertina</b>
</td>
</tr>
I would select the name of the images that is select
I can't select the right image. I select only the first image in the row. This is my code:
$('#table-image').find('tr').each(function () {
rowTable = $(this);
if (rowTable.find('input[type="checkbox"]').is(':checked')) {
value = rowTable.find('img').attr('src');
nomeCopertina =value.substring(value.lastIndexOf('/')+1);
}
Thanks for help
1
Reply
Replies(7)
jakecigar
Re: select the right image
9 months ago
You are making it harder to code by not putting the name in the radio button.
<input type='checkbox' " . $chk . " name='". $image ."> <b>Copertina</b>
Then you can just select the checkboxes and get their names. You could even put the abbreviated image name in there, and your code is even shorter.
JΛ̊KE
PS I think I got the quotes and double quotes right, but no guarantees on that.
Leave a comment on jakecigar's reply
vito
Re: select the right image
9 months ago
Ok, I can assign a name to the check box, but I need to select the image in the row that is checked.
Jake the double quotes there are because the code is printing by php, I try to best cleaning the code
Leave a comment on vito's reply
jakecigar
Re: select the right image
9 months ago
As the name would be the img src, you just search for the radios, ignoring the imgs.
You get 2 benefits,
1. The page
could
run without javaScript.
2. Your code is much shorter.
JΛ̊KE
Leave a comment on jakecigar's reply
vito
Re: select the right image
9 months ago
but the image and the radio button are in 2 different cells.
sorry I can't understand your idea.
can you write an example?
Leave a comment on vito's reply
jakecigar
Re: select the right image
9 months ago
Since you add all that code in the same loop, you would generate something like…
<tr>
<td>
<div>
<img class="deleteimage" src='
zippy.jpg
' />
<a href='' class='trash2'>
<i class='glyphicon glyphicon-trash'>
</i>
</a>
</div>
</td>
<td>
<input type='checkbox' checked name='
zippy.jpg
' />
<b>
Copertina
</b>
</td>
</tr>
JΛ̊KE
Leave a comment on jakecigar's reply
vito
Re: select the right image
9 months ago
ok I try to implements your solution. Thanks Jake
Leave a comment on vito's reply
jakecigar
Re: select the right image
9 months ago
demo
https://jsfiddle.net/jakecigar/9t1c9qbg/
<--
JΛ̊KE
Leave a comment on jakecigar's reply
Change topic type
Topic Type :
Discussions
Questions
Ideas
Problems
No of days :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Change topic type
Cancel
Link this topic
Provide the permalink of a topic that is related to this topic
Permalink
Save
Close
Reply to vito's question
Top
Reply
{"z40288063":[14737000007128060,14737000007128065,14737000007128067,14737000007128069],"z2950240":[14737000007127121,14737000007127125,14737000007127127,14737000007127129]}
Statistics
7
Replies
310
Views
1
Followers
Tags
Cancel
select cell
Actions
Permalink
Related Posts
[jQuery] Best way to select a cell ...
[jQuery] Best way to select a cell ...
[jQuery] select input within a tabl...
How to select the first empty cell ...
.change is not being detected from ...
How can I select a dropdown list in...