Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

setting html form values to other element values using js

  • 05-03-2013 5:11pm
    #1
    Registered Users, Registered Users 2 Posts: 7,639 ✭✭✭


    so here is a codepen I have been working on for a little feature for a friends website. http://codepen.io/Irish1/pen/cCmao

    Basically the user can use the color pickers on the left to create how they want their product to look. That part is done although if you have any advice on how to improve it that would be great.

    My main question is about the form that is underneath the color pickers. I want them to be autofilled by the value the user picks with the corresponding color picker. I then want the user to be able to click submit and the form is emailed to me.

    I know the code is probably messy and I havnt cleaned out the parts of the jquery plug in I wont be using yet so I hope you can get the idea.


Comments

  • Registered Users, Registered Users 2 Posts: 1,414 ✭✭✭Fluffy88


    Firstly never seen that codepen before, looks pretty cool.

    Second you can just add this line to each of the colour change functions,
    $('input[name="form_stripe"]').val($('select[name="stripe"]').val());
    

    There is probably better solutions but that works :)
    I haven't messed with jQuery or CSS is a good while so I'm not sure is there a cleaner way to get an element by it's name.
    If not, you should probably give each of the text boxes an ID and use it instead.


Advertisement