javascript - Multiple class Get each value - Stack Overflow

How can I get value of textbox appended with image tag. There is list of images with class="hi&quo

How can I get value of textbox appended with image tag. There is list of images with class="hi" and textbox with class multiple.

<div id="images">
    <img src="www.xyz/qwert.jpg" class="hi">
    <input type="text" class="multiple">
    <img src="www.xyz/qwerty.jpg" class="hi">
    <input type="text" class="multiple">
    <img src="www.xyz/qwertww.jpg" class="hi">
    <input type="text" class="multiple">
</div>

How can I get src and value of textbox ?

Script I tried:

var values = "";                    
$(".hi, .multiple").each(function () {                  
    imageURI = $(this).attr('src'); // I am getting imageURI
   ????                             //How can I get texbox value? 
 });

How can I get value of textbox appended with image tag. There is list of images with class="hi" and textbox with class multiple.

<div id="images">
    <img src="www.xyz./qwert.jpg" class="hi">
    <input type="text" class="multiple">
    <img src="www.xyz./qwerty.jpg" class="hi">
    <input type="text" class="multiple">
    <img src="www.xyz./qwertww.jpg" class="hi">
    <input type="text" class="multiple">
</div>

How can I get src and value of textbox ?

Script I tried:

var values = "";                    
$(".hi, .multiple").each(function () {                  
    imageURI = $(this).attr('src'); // I am getting imageURI
   ????                             //How can I get texbox value? 
 });
Share Improve this question edited Apr 14, 2015 at 7:32 Brijesh Bhatt 3,8303 gold badges20 silver badges34 bronze badges asked Apr 14, 2015 at 7:15 Nehil MistryNehil Mistry 1,1092 gold badges23 silver badges51 bronze badges 0
Add a ment  | 

3 Answers 3

Reset to default 5
$(".hi").each(function () {                  
    var imageURI = $(this).attr('src'); 
    var textBoxVal = $(this).next().val(); 
 });
$(".hi").each(function () {                  
    var imageURI = $(this).attr('src'); 
    var textBoxVal = $(this).next('input').val(); 
 });

Try this:

var values = "";                    
$(".hi, .multiple").each(function () {                  
    imageURI = $(this).attr('src'); // I am getting imageURI
    textBoxVal =  $(this).val();
 });)

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744242252a4564759.html

相关推荐

  • javascript - Multiple class Get each value - Stack Overflow

    How can I get value of textbox appended with image tag. There is list of images with class="hi&quo

    9天前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信