javascript - Create a reusable modal using JQuery -


I'm writing IF-ELSEIF-ELSE statement work in the loop in the work below, though I avoid writing too many Want to mesmerize Instead, when I click the image icon (basically an info image), then I'm looking for a JQuery model to pop up. I want to be able to pass this error in the function, which will then display in the modal. Example:

Say that I have 400 errors and 500 errors, when I click on the notification icon, the definition should be visible.

Code below:

index.gsp

  & lt; Html & gt; & Lt;% - Some codes (saving place for body) -%> & Lt; Body & gt; & Lt; Div id = "content" & gt; & Lt; Div id = "content-header" & gt; & Lt; H1 & gt; Error checking & lt; / H1> & Lt; / Div & gt; & Lt ;! - # content-header - & gt; & Lt; Div id = "content-container" & gt; & Lt; Div class = "portlet" & gt; & Lt; Div class = "portlet-content" & gt; & Lt; Div class = "table-responsive" & gt; & Lt; Table-class = "table-table-stripe table-barred table-hover table-highlight table-checkable" data-provide = "data-qualified" data-display-lines = "25" data-information = "correct" data- Search = "true" data-lie-change = "true" data-pagnet = "true" & gt; & Lt; Thead & gt; & Lt; TR & gt; & Lt; Th data-filterable = "true" data-order = "correct" data-direction = "empty" & gt; User ID & lt; / Th & gt; & Lt; Th data-filterable = "true" data-order = "correct" data-direction = "empty" & gt; Work id & lt; / Th & gt; & Lt; Th data-filterable = "correct" data-order = "correct" data-direction = "empty" & gt; Error message & lt; / Th & gt; & Lt; / TR & gt; & Lt; / Thead & gt; & Lt; Tbody & gt; & Lt; G: in each = "$ {lists}" var = "list" & gt; & Lt; TR & gt; & Lt; TD & gt; $ {List.userId} & lt; / TD & gt; & Lt; TD & gt; $ {List.taskId} & lt; / TD & gt; & Lt; TD & gt; **% {- want to call original here -}% ** ** & lt; A href = "" & gt; & Lt; I class = "fa-exclamation-triangle ui-popover pull-left" style = "color: # f0ad4e," & gt; & Lt; / I & gt; & Lt; / A & gt; $ {List.errorMsg} ** <& lt; / Td> & Lt; / TR & gt; & Lt; / G: each & gt; & Lt; / Tbody & gt; & Lt; / Table & gt; & Lt; / Div & gt; & Lt ;! - /.table-responsive - & gt; & Lt; / Div & gt; & Lt ;! - /.portlet-content - & gt; & Lt; / Div & gt; & Lt ;! - /.portlet - & gt; & Lt; / Div & gt; & Lt ;! - / # content-container - & gt; & Lt; / Div & gt; & Lt ;! - #content - & gt;   

I want to pop up this model:

  & lt; Div id = "style frack lager modal" class = "modal mode style style" & gt; & Lt; Div class = "modal-dialog" & gt; & Lt; Div class = "modal-content" & gt; & Lt; Div class = "modal-header" & gt; & Lt; Button type = "button" class = "off" data-rejected = "modal" Aria-hidden = "true" & gt; And;; & Lt; / Button & gt; & Lt; H3 class = "model-title" & gt; Issue & lt; / H3 & gt; & Lt; / Div & gt; & Lt; Div class = "modal-body" & gt; & Lt; / Div & gt; & Lt; Div class = "modal-footer" & gt; & Lt; Button Type = "Button" class = "BTN BTN-Tertiary" Data-Dismiss = "Model" & gt; Close & lt; / Button & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt ;! - /.modal-content - & gt; & Lt; / Div & gt; & Lt ;! - /.modal-dialog - & gt; & Lt; / Div & gt; & Lt ;! - /.modal - & gt;  

You can generate dynamic id using your list item id. You can then place your model in place where you have mentioned it. The following is an example of a code:

  & lt; Div id = "style fract anchor model $ {list.id}" class = "modal mode-style feed" & gt; [..] & lt; / Div & gt; & Lt ;! - /.modal - & gt;  If you are using jQuery-UI   
  & lt; A class = "OpenDialog" href = "# Style Frychler model $ {List.id}" & gt; Class = "fa-exclamation-triangle ui-popover pull-left" style = "color: # F.AD4A;" & gt; & Lt; / I & gt; & Lt; / A & gt;   

In your javascript:

  $ (document) .on ("click", "a.openDialog", function () {$ ($ (This) .attr ("href"). Dialog ();}   

If you are using bootstrap

  & lt; a data-toggle = "modal" href = "#tylefreak terrible model $ {list.id}" & gt; & lt; i class = "FA-FA-exclamation-triangle ui-popover bridge - left "style =" color: # f0ad4e; "& gt;      

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -