2012-03-06 9 views
1

私はqtipを使用して、qtipに表示されている埋め込みフォームを作成しようとしています。フォームに送信イベントを作成しようとしているときに何も起こりません。私はjquery 1.7と最新のqtipバージョンを使用しています。qtip2でフォームを使用できません。 (イベントがアクティブにならない)

私はhttp://craigsworks.com/projects/qtip2/demos/の例を使用しようとしましたが、そのデモは私には役に立たないでしょう。私のコードを見て、私が何か間違っているかどうか教えてください。

ありがとうございます!

$("#addNews").qtip({ 
    position: { 
     corner: { 
      target: 'bottomMiddle', 
      tooltip: 'topMiddle' 
     }, 
     adjust: { x: 0, y: 0 } 
    }, 
    show: { 
     when: { event: 'click' }, 
     solo: true 
    }, 
    hide: { 
     fixed: true, 
     when: { event: 'unfocus' } 
    }, 
    content: { 
     text: '<form id="frmAddNews"><div class="inputWrap left"><div class="label">Rubrik</div><input type="text" id="" name="" class="inputText" value="" /></div><div class="inputWrap left"><div class="labelTextarea">Meddelande</div><textarea id="" name="" class="inputTextarea" value=""></textarea></div><div class="submit_container"><input type="submit" value="Lägg till nyhet" /></div><div style="clear:both"></div></form>', 
    }, 
    style: { 
     border: { 
      width: 5, 
      radius: 2, 
      color: '#e1e1e1' 
     }, 
     width: 350, 
     background: '#FFF', 
     padding: 15, 
     tip: true, // Give it a speech bubble tip with automatic corner detection 
     name: 'cream' // Style it according to the preset 'cream' style 
    }, 
    events: { 
     render: function(event, api) { 
      $('form', this).bind('submit', function(event) { 
       event.preventDefault(); 
       console.log("hej"); 
      }); 
     } 
    }, 
}); 
+1

正確に何をしようとしているのかわかりません。しかし、あなたの '

'は '' #addNews "'に埋め込まれていますか?あなたのjQueryセレクタ '$( 'form'、this)'が問題になる可能性があります... –

+0

私はqtipの中に表示されているフォームを使用しようとしています。私はrender-functionの内部でconsole.logを使用しようとしましたが、そこには入っていません。コンテンツ内のテキストは私のフォームで構成されています。 – hgerdin

答えて

1

モーダルで表示するようにツールチップを設定すると、すばやく再生できました。で遊ぶために

show: { 
    event: 'click', // Show it on click... 
    modal: { 
     on: true, 

     // Don't let users exit the modal in any way 
     blur: false, escape: false 
    } 
}, 

The jsFiddle I was using

すなわちとしてあなたshowオプションオブジェクトを持っています。

+0

OPによって投稿された 'show'オプションはqTip 1.0からです。 –

+0

それはそれを説明するでしょう - 彼は最新のqtipバージョンを使用していますが、古い構文を使用していると言います。 – GregL

+0

あなたのコードをコピーしましたが、まだ動作しません。削除する必要がある他の古い構文がありますか? – hgerdin

関連する問題