我试图使用一些数组方法以某种方式摘录所有h3文本.但问题是选择我用作选择器的所有h3
var productTitle = $('#products-carousel').find('.single-trending-list').find('h3').text();
Run Code Online (Sandbox Code Playgroud)
它将所有h3文本拼凑在一起,最后我得到所有h3的相同文本
如何单独选择所有h3?
这是JSFiddle
这是我的代码:
var productTitle = $('#products-carousel').find('.single-trending-list').find('h3').text(),
productTitleExcerpt;
var toArray = productTitle.split("", 36),
joinArray = toArray.join(''),
joinArrayToArray = joinArray.split(" "),
joinArrayToArrayPop = joinArrayToArray.pop(),
joinArrayToArrayPopPush = joinArrayToArray.push('...'),
joinArrayToArrayPopPushJoin = joinArrayToArray.join(' '),
productTitleExcerpt = joinArrayToArrayPopPushJoin;
$('#products-carousel').find('.single-trending-list').find('h3').text(productTitleExcerpt);Run Code Online (Sandbox Code Playgroud)
<ul class="ul-trending-list" id="products-carousel">
<li>
<div class="single-trending-list">
<span>$90.00</span>
<h3>Leather Clutch, Gray Distressed</h3>
</div>
</li>
<li>
<div class="single-trending-list">
<span>$91.00</span>
<h3>Sori Yanagi Butterfly Y Wenge Stool</h3>
</div>
</li>
<li>
<div class="single-trending-list">
<span>$31.00</span>
<h3>BOTTLIT …Run Code Online (Sandbox Code Playgroud)z-index 不适用于它的::before/::after元素。在这里,我在下面分享代码。
.or {
border: 2px solid #8fc300;
border-radius: 5px;
color: #333;
font-size: 17px;
font-weight: 600;
height: 34px;
line-height: 26px;
text-align: center;
width: 34px;
margin-top: 64px;
margin-left: 20px;
margin-right: 20px;
background: #fff;
/*For z-index - keep the green area on top*/
position: relative;
z-index: 11;
}
.or::after {
background: red;
content: "";
display: block;
height: 116px;
margin-left: 15px;
margin-top: -68px;
width: 4px;
/*For z-index - keep the green area on top*/
position: relative;
z-index: 9;
} …Run Code Online (Sandbox Code Playgroud)//anonymous 1
(function(){
$('something').first().addClass("anything");
});
//anonymous 2
(function(){
$('something').first().addClass("anything");
})();
Run Code Online (Sandbox Code Playgroud)
这两者之间的实际和实际区别是什么?
(function(){
});
Run Code Online (Sandbox Code Playgroud)
和
(function(){
})();
Run Code Online (Sandbox Code Playgroud) 我已经将wordpress安装到内部目录中.喜欢root/mysite.为什么我没有在root上安装它,因为安装了这么多的插件域,我真的不想把所有插件域文件夹弄乱根目录下的wordpress文件.我的根目录是www.example.com.我已经安装了我的wordpress网站root/mysite,所以这个网址就是www.example.com/mysites.无论如何都要重定向www.example.com/mysites到www.example.com.正如我所说的那样,没有在我的root上安装wordpress的唯一原因,因为我不想弄乱wordpress文件,文件夹与root上的其他插件域的文件夹.
所以我的主要目标是显示www.jimfahad.com安装的wordpress网站www.example.com/mysites.有什么办法吗?