jQuery Dialog, simplifying code -


i using jquery dialog follows:-

    <a href="#" id="faq-1"><li><span class="black">- paid journey on credit card , @ later date got further charges. why?</span></li></a>      <div id="faq-1a" class="faq-a" title="i paid journey on credit card , @ later date got further charges. why?">         <p>when booking made via credit card take payment journey quoted. if reason journey amendments i.e.  waiting time or drop off, these charges separately billed therefore shown separate transaction on statement.</p>     </div>      <a href="#" id="faq-2"><li><span class="black">- how receipt journey made using credit card?</span></li></a>      <div id="faq-2a" class="faq-a" title="how receipt journey made using credit card?">         <p>if registered user please use online booking management via our website <a href="index.php">www.one2onecars.com</a>. have access journeys option print out receipts each journey or summary statement. if not registered, can email <a href="mailto:creditcardreceipts@one2onecars.com">creditcardreceipts@one2onecars.com</a> receipts.</p>     </div> 

jquery

   $(function() {          $('.faq-a').dialog({           modal: true,           resizable: false,           draggable: false,           width: '585',           autoopen: false,           position: [370,455],         });     });  });      $("#faq-1").bind('click', function(){          $("#faq-1a").dialog('open')      });      $("#faq-2").bind('click', function(){          $("#faq-2a").dialog('open')      }); 

i need 10 different dialogs, #faq-x range #faq-1 #faq-10

i'm sure there easier way write wouldn't have keep repeating:

$("#faq-3").bind('click', function(){      $("#faq-3a").dialog('open')  }); 

for every dialog create, can't figure out how appreciated!

why don't create class, instead of unique ids?

for #faq-1, #faq-2,........,#faq-10 assign of them same class e.g, faqclass

$(".faqclass").bind('click', function(){     $("#" + $(this).attr('id') + "a").dialog('open'); }); 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -