这是脚本的原始代码
var $mainCat=$('#main_cat').val();
我用这个代替了它
var $mainCat=$('#<how to pass the slug here>').val();
echo '<ul>';
foreach ($termchildren as $child) {
$term = get_term_by( 'id', $child, $taxonomyName );
echo '<li><a href="#" id=' .$term->slug. '>' . $term->name . ' </a></li>';
?>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" ></script>
<script type="text/javascript">
$(function()
{
$('a#<?php echo $term->slug; ?>').click(function()
{
$('#pop-up1').show();
$('#pop-up').show();
<?php echo $term->slug; ?>
var $mainCat=$('#<how to pass the slug here>').val();
现在我需要传递“a href”值,即。term->slug 到变量 $mainCat。我该怎么做,请帮助我