0
我已经提供了这个CSS如何动态地将一个类添加到href中?
<a href="#" class="tpActive">Butter Extra - Rs. 25/-</a>
我一直在努力这样
$(document).on("click", ".secclass a", function (e) {
// if(whetherchecked)
// {
var name = $(this).attr("name");
var topping='<div class="Topping-details"><section><a href="#">'+name+'</a></section></div>';
//$("a").addClass("tpActive");
//$(this).addClass(background-color: Green!important);
$(this).addClass("tpActive");
$("#myordersdiv").append(topping);
clcik++;
$("#myordersdiv").find("i.myorderhead22").text(clcik);
$("#myordersdiv").show();
//toppings.push(name);
// }
});
但选定的元素不被与该类反映? 任何人都可以请帮助我?
这是完整的CSS
<div class="Topping-details">
<img src="images/arrow-topping.png"/>
<section><i id="topping-close"></i>
<a href="#">Ketchup Extra - Rs. 25/-</a>
<a href="#" class="tpActive">Butter Extra - Rs. 25/-</a>
<a href="#">Cheeze Extra - Rs. 25/-</a>
</section>
</div>
'$(this).addClass(“tpActive”);' –
你想在其上添加一个“a”类。点击一个或存在于顶部变量 –
点击一个。 – Pawan