Link to home
Start Free TrialLog in
Avatar of rivkamak
rivkamakFlag for United States of America

asked on

jquery multiple selector options.

I am trying to get a complex jquery selector statement.
Something along this lines
($('input').attr('id', data.field) );
the selector that  I need is :
the input field on my page. whose attribute ID matched the variable in data.field

but I need as output the value of the attribute 'value' of that specific input field.
how do I combine that together?
Avatar of zappafan2k2
zappafan2k2

$('#'+data.field).val()
should return the value of the element whose id matches the value of data.field
Avatar of rivkamak

ASKER

How do I do the opposite?
the selector should be where the id is the value of the attribute 'data' on the field #popinput
Can i do something like this?
      fieldname = $('#popinput').attr('data-name');
 $(fieldname).attr('value', $('#popinput').val() );
ASKER CERTIFIED SOLUTION
Avatar of zappafan2k2
zappafan2k2

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you for your help.
In concept it works great..

You can view my page here:
https://www.oorahauction.org/prizes.asp

if you put an quantity in the prize box, then click on the image, it will pop up with more information and the prize box in the popup will have the same amount as the box on the page.

if you change the amount in the popup box, when you close the popup , the field on the main page will adjust to that new amount

yet, when you click on another image, and the box pops open, the input box is still filled out with the amount you put in before, not matching that correct quantity of that prize.but if you check the code, the jquery worked and the value is blank.

Why is the input box showing an old number is the value in the code is really empty?