为什么文本字段没有被禁用=彩色框弹出窗口中的“禁用”?

时间:2013-09-19 08:59:28

标签: javascript php jquery smarty colorbox

我正在为我的网站使用PHP,Smarty,jQuery,Colorbox - 一个jQuery灯箱插件等。现在我在弹出窗口中显示一些输出,这是通过使用“Colorbox - 一个jQuery灯箱插件”生成的。现在我想在表单加载时禁用此弹出窗口中显示的所有文本字段但是如果我转到HTML页面源,disabled="disabled"标记中的<input>属性将被删除,文本框不会被删除被禁用。你能告诉我为什么会这样吗?作为参考,我把它放在代码下面,该代码将在Colorbox弹出窗口中显示数据。

{if $subject_topic_questions}
            {foreach from=$subject_topic_questions item=subject_topic_data}
            <div class="hidden">        
              <div id="topics_{$subject_topic_data.subject_id}" class="c-popup">
                <h2 class="c-popup-header">Select Topics</h2>
                <div class="c-content">

                    <input type="hidden" name="subject_names[{$subject_topic_data.subject_id}]" id="subject_names" value="{$subject_topic_data.subject_name}">
                    <h2 class=""> {$subject_topic_data.subject_name}</h2>
                      <div class="c-tbl-wrap">
                        <table width="100%" cellspacing="0" cellpadding="0" border="0" class="c-tbl">
                          <tbody>
                            <tr>
                              <td>
                                <p class="custom-form">
                                  <input class="custom-check" type="checkbox" name="" id="">
                                  <label class="blue">Select All</label>
                                </p>
                              </td>
                      {foreach from=$difficulty_levels item=diff_levels key=dkey}
                              <input type="hidden" name="diff_levels[{$dkey}]" value="{$diff_levels}">
                              <td width="22%" align="center"><strong>{$diff_levels}</strong></td>
                      {/foreach}
                            </tr>
                      {foreach from=$subject_topic_data.topics item=topic_diff_level_data}
                            <input type="hidden" name="subject_{$subject_topic_data.subject_id}_topics[]" value="{$topic_diff_level_data.topic_id}">
                            <tr>
                              <td valign="middle">        
                                <p class="custom-form">

                                  <input type="checkbox" class="custom-check" name="{$sheet_type}_topics_{$subject_topic_data.subject_id}[]" id="{$sheet_type}_{$subject_topic_data.subject_id}_{$topic_diff_level_data.topic_id}" value="{$topic_diff_level_data.topic_id}" onChange="enable_topic_ques('{$sheet_type}', '{$subject_topic_data.subject_id}', '{$topic_diff_level_data.topic_id}'); return false;">

                                <label>{$topic_diff_level_data.topic_name}</label>
                                <!-- <input type="hidden" name="topic_names[{$topic_diff_level_data.topic_id}]" value="{$topic_diff_level_data.topic_name}">   -->
                                </p>                   
                              </td>
                              {foreach from=$topic_diff_level_data.difficulty_level item=diff_level key=key_diff_lvl}
                              <td valign="middle">                 
                              {if $site_id=='ENTPRM'}<em>Total {$diff_level.question_count}</em>{/if}
                                <input type="text" name="{$sheet_type}_{$subject_topic_data.subject_id}_{$topic_diff_level_data.topic_id}_{$key_diff_lvl}" id="{$sheet_type}_{$subject_topic_data.subject_id}_{$topic_diff_level_data.topic_id}_{$key_diff_lvl}"  maxlength="3" class="mini" value="{$diff_level.added_no_questions}" disabled="disabled">
                                <input type="hidden" name="{$sheet_type}_available_questions_{$subject_topic_data.subject_id}_{$topic_diff_level_data.topic_id}_{$key_diff_lvl}" value="{$diff_level.question_count}">
                              </td>
                              {/foreach}               
                            </tr>
                            {/foreach}            
                          </tbody>
                        </table>
                      </div>  
                      <p class="center"><a href="#" class="c-btn fnClosePopup">Done</a> <a href="#"class="c-btn c-gray-btn fnClosePopup">Cancel</a></p>
                    </div>
                  </div>
                </div>
                {/foreach}
                {/if}

您需要考虑的主要代码如下所示:

<input type="text" name="{$sheet_type}_{$subject_topic_data.subject_id}_{$topic_diff_level_data.topic_id}_{$key_diff_lvl}" id="{$sheet_type}_{$subject_topic_data.subject_id}_{$topic_diff_level_data.topic_id}_{$key_diff_lvl}"  maxlength="3" class="mini" value="{$diff_level.added_no_questions}" disabled="disabled">

你能告诉我在页面加载后,disabled =“disabled”属性是如何消失的,如果有任何方法可以申请,请告诉我。提前谢谢。

1 个答案:

答案 0 :(得分:0)

$('.mini').prop("disabled", true);
$('.mini').prop("disabled", false);

试试这个