Board logo

標題: [操作疑難] jquery onclick modal [打印本頁]

作者: carlkyo    時間: 2015-11-4 14:04     標題: jquery onclick modal

請問CHING
有冇SAMPLE我睇睇啊
例如
  1. <li>1</li>
  2. <li>12</li>
  3. <li>13</li>
複製代碼
click落任何一個li可以打開modal或網址(唔想有?id=xxx)
many thanks
作者: carlkyo    時間: 2015-11-4 14:30

請問CHING
有冇SAMPLE我睇睇啊
例如click落任何一個li可以打開modal或網址(唔想有?id=xxx)
many thanks ...
carlkyo 發表於 2015-11-4 14:04



    找到呢個
  1. $('.trash').click(function(){
  2.     var id=$(this).data('id');
  3.     $('#modalDelete').attr('href','delete-cover.php?id='+id);
  4. })
複製代碼

作者: stta800    時間: 2015-11-4 15:24

https://jqueryui.com/dialog/#modal-confirmation

like this??
作者: carlkyo    時間: 2015-11-4 15:55

本帖最後由 carlkyo 於 2015-11-4 16:26 編輯
like this??
stta800 發表於 2015-11-4 15:24



   成功用左modal加.text
   開新頁唔知得唔得
   好少用jquery~~"
thanks
作者: carlkyo    時間: 2015-11-4 16:27

本帖最後由 carlkyo 於 2015-11-4 16:28 編輯

ching
咁寫正確嗎
選完會出好多欄input
many thanks
  1. <script>
  2. $(document).ready(function(){
  3.     $(".field").change(function(){      
  4. if($('.field').val()=='volvo'){
  5. $("#res").html("<input type='text' value='ABC'><input type='text' value='ABC'>");
  6. }
  7. if($('.field').val()=='saab'){
  8. $("#res").html("<input type='text' value='ABCD'><input type='text' value='ABCD'><input type='text' value='ABCD'>");
  9. }
  10. });
  11. });
  12. </script>
  13. </head>
  14. <body>

  15. Car:
  16. <select class="field" name="cars">
  17.   <option value="volvo">Volvo</option>
  18.   <option value="saab">Saab</option>
  19.   <option value="fiat">Fiat</option>
  20.   <option value="audi">Audi</option>
  21. </select>

  22. <p id="res">Select an option in the drop-down list.</p>
複製代碼

作者: wongfung    時間: 2015-11-4 20:37

ching
咁寫正確嗎
選完會出好多欄input
many thanks
carlkyo 發表於 2015-11-4 16:27


https://jsfiddle.net/q2co7c8L/
你想咁?
作者: carlkyo    時間: 2015-11-4 21:16

你想咁?
wongfung 發表於 2015-11-4 20:37



    唔同選擇有唔同表單
係唔係咁寫就ok
thx
作者: wongfung    時間: 2015-11-4 21:52

唔同選擇有唔同表單
係唔係咁寫就ok
thx
carlkyo 發表於 2015-11-4 21:16



你係想個DROPDOWNLIST揀唔同選項嗰陣出唔同TEXTBOX, 定個TEXTBOX出唔同字?
另外善用variable可以減少重複寫CODE的
作者: carlkyo    時間: 2015-11-4 22:20

你係想個DROPDOWNLIST揀唔同選項嗰陣出唔同TEXTBOX, 定個TEXTBOX出唔同字?
另外善用variable可以減少重 ...
wongfung 發表於 2015-11-4 21:52



   除寫多個function諗唔到其他~~
作者: carlkyo    時間: 2015-11-5 09:48

試下用呢個
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
  5. <script>
  6. $(document).ready(function(){
  7.     $("button").click(function(){
  8.         $("#div1").load("http://www.tutorialspoint.com/html/html_tables.htm");
  9.     });
  10. });
  11. </script>
  12. </head>
  13. <body>

  14. <div id="div1"><h2>Let jQuery AJAX Change This Text</h2></div>

  15. <button>Get External Content</button>

  16. </body>
  17. </html>
複製代碼





歡迎光臨 電腦領域 HKEPC Hardware (https://www.hkepc.com/forum/) Powered by Discuz! 7.2