views:

360

answers:

1

I have a modal dialog which opens on click of Edit button of my webpage. I am passing the values to the onclick handler (which calls $("#editdialog").dialog('open');). Beside opening the dialog I need to populate form inputs within the dialog with values passed to the onclick event handler. I am doing this: $("#editfrm > input[id='FirstName']").val(name); where name is a passed parameter value. But somehow the above code is not working. Please Help.

A: 

When jQuery silently fails, it usually means that you have an empty selection. So the first thing to test is that the selector $("#editfrm > input[id='FirstName']") really does produce the fields you think it does. Pull up firebug and type that selector into the console. If it works, it will produce an array with the input element you want. If not, it'll produce an empty list.

Marcus Downing