jQuery UI Question. How to pass parameters to a function.
Posted
by jiji40
on Stack Overflow
See other posts from Stack Overflow
or by jiji40
Published on 2010-03-03T09:42:04Z
Indexed on
2010/03/09
0:36 UTC
Read the original article
Hit count: 434
I am pretty new to jQuery.
How do I pass parameters to a function? I found some jQueryUI demos and I got it working except "view" link.
I have a problem with passing parameters to and show them in modal popup windows.
I have "Create New User" button and "View" link on the page. Clicking "Create New User" does pass the parameters and show them on modal popup window. ('12345' in User ID textbox, 'John Starks' in User Name textbox)
$(function() {
...
//Create New User button
$('#create-user')
.button()
.click(
function() {
$('#dialog-form').dialog('open');
userId.val('12345');
userName.val('John Starks');
}
);
});
But, "View" link doesn't work... Clicking "View" link does pop up modal window with no value in the textbox(User ID and User Name)
function doView( idP, nameP )
{
$('#dialog-form2').dialog('open');
userId.val(idP);
userName.val(nameP);
}
<a href="#" OnClick="doView('001','John Doe');" >view</a>
...
How to pass the parameters to modal window?
Thanks in advance.
© Stack Overflow or respective owner