0

ダイアログがあります -

<div data-role="dialog" id="msg-popup">
  <div data-role="header">
      <h1>Notification</h1>
  </div>

  <div data-role="content" id> 
    <b id="notif-subject"></b>  
    <a href="#notif-details1" id:"show-notif" data-role="button">Show notification</a>
    <a href="#" data-rel="back" data-role="button">Cancel</a>
  </div> 
</div>

jquery コードを使用して、show-notif ボタンを動的に非表示および表示したいと考えています。どうすればいいですか?

私が試してみました

$("#show-notif").hide(); 

これは私にはうまくいきませんでした。何か案は?

4

3 に答える 3

2

小さな構文エラーがあるようです:

<a href="#notif-details1" id:"show-notif" data-role="button">Show notification</a>

次のようにする必要があります ( に置き換えます:) =:

<a href="#notif-details1" id="show-notif" data-role="button">Show notification</a>

これらの関数は動作するはずです:

$('#show-notif').hide();
$('#show-notif').show();
于 2012-06-25T16:10:17.113 に答える
1

HTMLコードのこの行は、

<a href="#notif-details1" id:"show-notif" data-role="button">Show notification</a>

これ

<a href="#notif-details1" id="show-notif" data-role="button">Show notification</a>

使用する必要があるため

id="show-notif"

jsfiddleデモ:http ://jsfiddle.net/MfQeF/

于 2012-06-25T16:12:05.247 に答える
0

id:"show-notif" は有効なステートメントではありません。

id="show-notif" である必要があります

Firefox (または Chrome) を html バリデーターや web developer などのプラグインと共に使用します。構文エラーを表示できます。

于 2012-06-25T16:14:03.563 に答える