Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7593775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:15:13+00:00 2026-05-30T21:15:13+00:00

Working code in JSFIDDLE I have put the complete code in JSFiddle , the

  • 0

Working code in JSFIDDLE

I have put the complete code in JSFiddle, the problem is that it fetches the val of the first input box, but doesn’t fetch the content where the checkbox is checked?

Html

<div class="gallery_content_wrap">
<!-- video wrap-->

<div class="gallery_photo_wrap">
  <div class="gallery_bg_wrap">
  <input type="hidden" value="10" name="selectypeaccept">
  <input type="hidden" value="photos" name="subadmintypeaccept">

        <div name="photosacceptdiv" class="gallery_bg"> <img width="200px" border="0" height="148px" src="http://farm8.staticflickr.com/7180/6846918679_7891edd209_t.jpg">  
<br>   <input type="text" value="" id="phototitle">  <input type="checkbox" value="1d7457596c0f202ae373de1737bb0e4a.png" name="photosaccept">
      </div>

  </div>
</div>
<!-- video wrap-->

<div class="gallery_photo_wrap">
  <div class="gallery_bg_wrap">
  <input type="hidden" value="10" name="selectypeaccept">
  <input type="hidden" value="photos" name="subadmintypeaccept">

        <div name="photosacceptdiv" class="gallery_bg"> <img width="200px" border="0" height="148px" src="http://farm7.staticflickr.com/6186/6054843777_4e90c30827_t.jpg">  
<br>   <input type="text" value="" id="phototitle">  <input type="checkbox" value="3.png" name="photosaccept">
      </div>

  </div>
</div>
<!-- video wrap-->

<div class="gallery_photo_wrap">
  <div class="gallery_bg_wrap">
  <input type="hidden" value="10" name="selectypeaccept">
  <input type="hidden" value="photos" name="subadmintypeaccept">

        <div name="photosacceptdiv" class="gallery_bg"> <img width="200px" border="0" height="148px" src="http://farm8.staticflickr.com/7021/6846957961_779518a6c5_t.jpg">  
<br>   <input type="text" value="" id="phototitle">  <input type="checkbox" value="9d0757dd339b0b1afa3aabe6b1a50cda.png" name="photosaccept">
      </div>

  </div>
</div>
<!-- video wrap-->    

<div class="gallery_photo_wrap">
  <div class="gallery_bg_wrap">
  <input type="hidden" value="10" name="selectypeaccept">
  <input type="hidden" value="photos" name="subadmintypeaccept">

        <div name="photosacceptdiv" class="gallery_bg"> <img width="200px" border="0" height="148px" src="http://farm8.staticflickr.com/7181/6858152461_91dd47bfc8_t.jpg">  
<br>   <input type="text" value="" id="phototitle">  <input type="checkbox" value="26a70bb20de5d595d2fde46abbc740f8.png" name="photosaccept">
      </div>

  </div>
</div>
<!-- video wrap-->            

</div><div align="center"><input type="submit" name="submitaccept" value="Approve"/><input type="submit" name="submitacceptreload" value="Reload"/>
</div>

Jquery

$("[name=submitaccept]").click(function(){
    checktype();
});

function checktype(){
    $("[name=photosaccept]").each(function() {       
        if ($(this).is(':checked')) {
            $phototitle=$(this).val();
            alert($("#phototitle").val());
            $photoname = $("#phototitle").val();
        }
    });            
}​
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T21:15:15+00:00Added an answer on May 30, 2026 at 9:15 pm

    Replace your $.each function with this

    $("[type=checkbox]").each(function() {
        if($(this).is(':checked')){
            alert($(this).closest("div.gallery_bg").find("input[type=text]").val());
        }
    });
    

    and it should work.

    But I must stress however, that you listen to what the guys above are saying, to prevent future errors from occurring.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

JSfiddle (showing the non-working code) here: http://jsfiddle.net/ts2Rr/ I have three boxes that a user
I have a problem with ui dialog close function. My code working first click
I have the following working code: http://jsfiddle.net/NtHwN/4/ It will deduct the number that is
I have the following piece of code - jsfiddle example The problem i'm having
Problem in brief I have got a piece of working two dimensional scrolling code.
I have a jsfiddle that demonstrates the problem at: http://jsfiddle.net/michaelajohnsonwa/sDchM/7/ The generated dropdown elements
I have a working Jquery code in http://jsfiddle.net/anderskitson/Efbfv/5/ However on my site at http://anderskitson.ca/tests/javascript/bottlesForm.html
This code is working fine on jsFiddle but not on my system. JsFiddle I
EDIT: See my working code in the answers below. In brief: I have a
do you have a working code to share. I’m trying to figure out how

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.