Double jQuery in a single wep page -


Since I can not create two forms in one page, I'm trying to use two separate jQuery:

$ (document) .ready (function () {

To open the same form with a different button, a new title and button

This is my code:

  

& lt; button id = "newuserbutton" & gt; ; Create new user & lt; / button & gt; & lt; / p & gt; & lt; p & gt; & lt; button id = "Edituser" & gt; update user & lt; / button & gt; & lt; / p & gt; script "text / javascript" & gt; $ (document) .ready (function () {$ ('# Div1 '). (""), "Cancel": function () {modal: true, autoOpen: incorrect, title:' create new user 'button: {"create user": function () {$ (this). Dialog ("") $ (this) .dialog ("close");}}} $ ('# newuserbutton'). Click (function () {$ ('# div1'). Dialog ('Open') ; $ ("# (" Color "," gray "); $ ("# div1") Dialog ({minHyight: 300, minWidth: 550}); // $ ("*"). CSS ('color', 'red');});}); & Lt; / Script & gt; LT; Script & gt; $ {Document} .ready (function () {$ ('# div1'). Dialog ({modal: true, autoOpen: false, title: 'user edit', button: {"Save changes": function () { $ (This) .dialog ("Warning");}, "$ (this)", "delete": function () {$ (this) .dialog ("" ")," delete " Cancel "$ ('Spin.ui-dialog-title'); $ ('# edituser'). $ (" # Div1 "). CSS (" color "," gray ");}); & lt; / Script & gt;

I click on different buttons, but all forms of form are opened with three buttons which is another jquery.

Jquery a bit How can I use it? Or if there is any way, I can create a new form in the jQuery function? Thanks for the suggestions.

The problem is that you are restarting the jquery ui widget model twice, div with id # div1 . In short, this is what you are doing: < / P>

  $ (# div1) .dialog ({...}) .dialog ({...});   

Of course when you $ (# Div1) .dialog ('open'), call the modal according to the second initialization. Will that save 3 buttons "change", "delete" and a model with "Cancel".

You should either use 2 differents divs ( simplest method ) or use only a div and the modal open ( clean way ) To manage the model content.

I have written it to confuse on the other side;)

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -