【问题标题】:'ticked' checkbox in php wordpress [duplicate]php wordpress中的“勾选”复选框[重复]
【发布时间】:2017-07-27 18:01:15
【问题描述】:

我对编码完全陌生。因此寻求帮助以仅“检查”复选框以“无法找到字符”回显。我怀疑它是某种 if/else 语句,但经过多次试验和错误,我最终检查了所有复选框(这是不正确的)。非常迷茫……所以我在这里向专家寻求您的指导。附上我怀疑的相关原文,供各位专家指教,非常感谢:

echo '<tr>';
    echo '<th valign="top" class="label" scope="row">';
    echo '<input type="checkbox" class="chkLink alignleft">';
    echo '<span class="alignleft"><label for="cartoon">';
    _e('Source URL', 'cartoon');
    echo '</label></span>';
    echo '<span class="alignright"><abbr class="required" title="required">*</abbr></span>';
    echo '</th>';

function cartoon_we_fetch_names_callback() {
$url = CARTOON_EMBED_IMP_UTILITIES::globalRequest('cartoon_we_url');

$html = cartoon_file_get_html($url);

if(!$html) {
    echo '<div class="error notice-error notice-alt">Unable to find Character</div>';
    wp_die();
}


$names = $html->find('#names > ul', 0);

if(!$names) {
    echo '<div class="error notice-error notice-alt">Unable to find Character</div>';
    wp_die();
}

foreach ($names->find('.namesnumber') as $e) {
    $e->outertext = '<input type="checkbox">' . $e->outertext;
}

foreach($names->find('a') as $link){
    if($link->href) {
        $id = split('#', $link->href);
        $id = $id[1];
        $link->href = 'javascript:void(0);';
        $link->outertext = $link->innertext;
        $link->dataTarget = $id;
        $link->parent()->datatarget = $id;
    }
}

【问题讨论】:

  • 感谢@J.chomel。你能给我建议吗?

标签: php wordpress checkbox


【解决方案1】:

您可以只使用checked 属性:

echo '<input type="checkbox" class="chkLink alignleft" checked>';

【讨论】:

  • 非常感谢@MrDarkLynx。我稍微改变了我的问题,希望你也可以看看和评论。谢谢。
  • @Aaron.T 略有改变 可能有点低调。你应该问一个新问题。
猜你喜欢
  • 1970-01-01
  • 2013-09-01
  • 1970-01-01
  • 1970-01-01
  • 2015-02-13
  • 2010-12-15
  • 2023-02-09
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多