1

I'm implementing various lists with modal option boxes. Picture a list of properties (found at www.keydataweb.co.uk/bootstrap/manageprops.php ) - When a user wishes to perform an action, I'm firing a Modal and need to pass it the ID of the property. I'm basing my approach to this heavily on a response I found on stack overflow, but once placed into the page It's ceasing to function. I'm thinking it may be something to do with my JS, but I'm not entirely sure how best to place it, or correct any current error I'm having:

$(document).on("click", ".open-delPropDialog", function () {
     var propForDel = $(this).data('id');
     $(".modal-body #propId").val( propForDel );
    $('#delPropDialog').modal('show');
});

Here's a forked JSFiddle with my current code: http://jsfiddle.net/mxqUX/

The JSFiddle has been integrated to my page, but not styled yet so the two buttons are sat at the top.

Please Help!

Originally based on: (http://stackoverflow.com/questions/10626885/passing-data-to-a-bootstrap-modal)

Florent
  • 12,310
  • 10
  • 49
  • 58
Sean Leach
  • 70
  • 6

1 Answers1

1

What you have here in the code block:

$(".modal-body #propId").val( propForDel );

What you have in your JSFiddle and on your site:

$(".modal-body #delPropDialog").val( propForDel );

Fix your JSFiddle and your site to match the code that you have in your code block then you should be good to go.

Updated jsfiddle

Sherbrow
  • 17,279
  • 3
  • 64
  • 77
16dots
  • 2,941
  • 1
  • 13
  • 15
  • Cheers, whilst that was an error, it's still refusing to work.I've put a tracer popup into the JS and it never gets fired. When run from JSFiddle it works no issue but within the actual page it is never called. :/ – Sean Leach Oct 24 '12 at 20:05
  • @SeanLeach If you inspect your own page, you can see in the console that there is an "Uncaught ReferenceError: $ is not defined" to fix that, load jquery in before your own scripts. Your JQuery library has to be loaded before you do anything with it. – 16dots Oct 24 '12 at 20:46
  • That'd be it. Not sure why I didn't think of that. Problem Solved :) – Sean Leach Oct 24 '12 at 21:18