Save 36% for Black Friday! Learn more

Charlie Gaines

Joined

170 Experience
1 Lesson Completed
0 Questions Solved

Activity

Posted in Radio buttons as actual buttons

Thanks Chris...I figured it out in the end using the native Bstrap functionality. But for another framework you might need to use an approach like the one I pasted in above, no?

Posted in Radio buttons as actual buttons

Yea that's how I ended up doing it - with Bootstrap buttons and JS and a hidden input. How could I improve this?

$('button.assessment-button').click (e)->
    e.preventDefault()
    val = $(this).attr('value')
    $(this).parent().siblings().find('input').val(val)

Posted in Radio buttons as actual buttons

Hey all,

I am trying to convert a form with radio buttons such that the radio buttons are just plain buttons. When selected they should have an active class and register the selected choice. I've looked around a bunch for a solution...and have tried several things myself with no luck. Has anyone tackled this problem?

Thanks,

Charlie

logo Created with Sketch.

Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

© 2020 GoRails, LLC. All rights reserved.