[英]Using Jquery, how do you change the css of the object you are clicking?
我正在一個非常動態的頁面上工作,為了簡單起見,該頁面將有很多我們稱為按鈕的按鈕(實際上是div)。
這些按鈕內部有一個span標簽,其中display:none;
。 所有這些“按鈕”的內部都有跨度,而css類則將其隱藏了。 我無法為每個ID創建一個ID,它們將是動態的
我怎樣才能使用Jquery在僅單擊的項目上使用.show()
動畫.show()
。 我無法輸入ID,因為它將使用php動態創建。
$('.button').click(function(){
$(this).find('span').show();
})
$(".className or #idName").css("thecssselector", "thevalue");
使用這個jQuery:
$(document).ready(function(){
$("tag name or id on which you will click").click(function(){
$("tagname on which you want to apply the css").css("property_name","property_value");
});
});
這里有一些小提琴。
$('div').click(function(){
$(this).find('span').fadeIn("slow");
});
嘗試這個
$(".button").click(function(){
$("div span").hide();
$(this).find("span").show();
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.