[英]Using Jquery, how do you change the css of the object you are clicking?
I am working on a very dynamic page which will have a lot of what we will call buttons for simplicity sake (actually are divs). 我正在一个非常动态的页面上工作,为了简单起见,该页面将有很多我们称为按钮的按钮(实际上是div)。
These buttons have a span tag inside which has display:none;
这些按钮内部有一个span标签,其中
display:none;
. 。 This all of these "buttons" have the Span inside with the css class which has them hidden.
所有这些“按钮”的内部都有跨度,而css类则将其隐藏了。 I can not create an #ID for each one, they are going to be dynamic
我无法为每个ID创建一个ID,它们将是动态的
How can I, using Jquery, animate using .show()
just the item being clicked. 我怎样才能使用Jquery在仅单击的项目上使用
.show()
动画.show()
。 I can not input an ID, because it will be created dynamically with php. 我无法输入ID,因为它将使用php动态创建。
$(".className or #idName").css("thecssselector", "thevalue");
use this jQuery: 使用这个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");
});
});
try this 尝试这个
$(".button").click(function(){
$("div span").hide();
$(this).find("span").show();
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.