flandish Posted March 16, 2012 Share Posted March 16, 2012 I have this code: $(document).ready(function() { $('select').change(function(){ $('#primary_block #image-block', $(this).parent()).removeClass('green blue').addClass( $(this).find('option:selected').text().toLowerCase().replace(/\s/g, "") ); }) .change(); }); It changes the background colour of a selected div when an option is selected from a dropdown box. What do I need to change for it to work with custom attributes and where do I place it? (along with the "green" and "blue" classes). The classes are: .green{ background-color:green; } .blue{ background-color:blue; As you can see I have already tried targeting "#primary_block #image-block" with no luck Any help would be great! Thanks. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now