Jquery modal prompt

If you’ve tried the impromptu jquery plugin, you’re probably left with some frustrating feeling, finding that  such an easy solution for javascript alert, confirm and prompt replacement, could be enhanced by a nicer graphic design. Replacing the “X’” letter by a now standard close button, just like can be found on facebox, could do the job. But then why not benefit default facebook style layout and use the whole facebox plugin, or go for another stylish modal jquery plugin, such as jModal… A few lines of javascript code will easily replace the prompt function, just like the lines of code from the example below.

  1. function jqPrompt(lang, uniqueId, qty , MsgPerso)
  2. {
  3.  
  4. strPrompt ="Please enter your name";
  5. msg = "<<div class=’notice-msg’ style=’border:0px;’>"+ strPrompt ;
  6. msg =  "<br><br><input type=’text’ size=’40′ value=’" + MsgPerso + "’ id=’persoValue’>";
  7. msg += "<a href=’javascript:closeFaceBox( jQuery(\"#persoValue\").val() )’ class=’valid-button’> Submit</a>";
  8. msg += ‘ <a href="javascript:closeFaceBox(null)" class="cancel-button">Cancel</a> ‘
  9. msg += "</div>";
  10. jQuery.facebox(msg)
  11. }
  12. function closeFaceBox(MsgPerso)
  13. {
  14. jQuery(document).trigger(‘close.facebox’);
  15. if (uniqueId!=null && MsgPerso!="")
  16. displayCart(lang, uniqueId, qty, MsgPerso)
  17. }
  1. One Response to “Jquery modal prompt”

  2. a new implementation has been made public with prompt, alert, confirm jquery replacements . Check out

    http://abeautifulsite.net/notebook_files/87/demo/

    By admin on Jan 5, 2009

Post a Comment