我需要在点击时添加一些jquery,当联系表单在模态窗口中打开时。我正在尝试使用控制台并且它正在工作,但是当我尝试添加文件时,没有任何变化。我的代码是
$strFilter = "computer"
$objDomain = New-Object System.DirectoryServices.DirectoryEntry
$objSearcher = New-Object System.DirectoryServices.DirectorySearcher
$objSearcher.SearchRoot = $objDomain
$objSearcher.SearchScope = "Subtree"
$objSearcher.PageSize = 1000
$objSearcher.Filter = "(objectCategory=$strFilter)"
$colResults = $objSearcher.FindAll()
$counter = 0
foreach ($i in $colResults)
{
$objComputer = $i.GetDirectoryEntry()
if (Test-Connection -Computername $objComputer.Name -BufferSize 16 -Count 1 -Quiet) {
Get-Service -ComputerName $objComputer.Name -Name 'svcname' | ? { $_.Status -eq 'Stopped' } | Start-Service
}
$counter++
Write-Host "finished " + $counter
}
所以我需要从页眉中复制一个标题,然后将其粘贴到模态联系表单的顶部。 您可以在此处找到表单word press web site
然后点击与我联系。当我尝试在控制台添加
jQuery('.fl_box-menu-0 ').click(function(){
var myClone = jQuery('.container_inner .title_subtitle_holder span').clone();
jQuery(myClone).prependTo("#cboxContent form");
})
它是工作并添加标题,但是当我尝试在我的文件中添加代码时,没有任何变化。那么我做错了什么?我使用联系表格7,并形成灯箱用于模态。 所以现在我正在寻找文件,在哪里添加jquery代码,以使其正常工作。
答案 0 :(得分:0)
I would try this with a delegated event:
jQuery(document).on('click', '.fl_box-menu-0', function() {
var myClone = jQuery('.container_inner .title_subtitle_holder span').clone();
jQuery(myClone).prependTo("#cboxContent form");
})
Reasons for using delegated events can be found here.
It's not clear if this is the issue, or only issue, but it if your click is not working like you except, and console is, then chances are that the click is not getting bound properly (dynamic element perhaps).