Reputation: 21
i'm creating visual configurator for a car and wheels.
The whole rests of two variables, basic is a car, next one is wheels. I have two columns with buttons of cars and wheels. When i select own options, website show right individual picture.
I thought, that car is #ID element, whhels is .Class element When i selecting cars, ID is changing, when i selecting wheels Class is changing
Something like this:
<div id="car_2" class="wheel_5">
I tried to removeID, removeClass by .click(function(), but doesn't work. How can i do that. I have 15 cars and 4 wheels.
Can you help me?
Upvotes: 1
Views: 43
Reputation: 21
Ok, i found solution If anybody won's to remove ID and add noweone by click he cna use this
$( "#car_2_button" ).click(function() {
$("#visualization div").removeAttr("id"); //remove ID
$("#visualization div").attr("id", "car_2"); //adding new ID
});
The same code is working with class
$( "#wheel_2_button" ).click(function() {
$("#visualization div").removeAttr("class"); //remove class
$("#visualization div").attr("id", "wheel_2"); //adding new class
});
Upvotes: 1