0

I am having problem running the following script in my application. The action is not working I tried altering the script in the following ways

Test 1

<script type="text/javascript">
$.noConflict();
$(document).ready(function () {
    $('.deleterd').on('click', function(){
    $(this).closest('div').remove();
});
</script>

Test 2

    <script type="text/javascript">
    jQuery.noConflict();
      (function( $ ) {
       $('.deleterd').on('click', function(){
        $(this).closest('div').remove();
     });
    </script>

Test 3

  jQuery(function($) {
    $.noConflict();
    $(document).ready(function () {
        $('.deleterd').on('click', function(){
        $(this).closest('div').remove();
    });

Tried with no conflict, without no conflict but still the script is not working.

When I paste the same script in the console then the script is working fine. I tried placing the script in the top, bottom, middle of other scripts but still no use. Any help is highly appreciated.

No, still not working. Also, I am getting an error in the browser console as "TypeError: Undefined is not a function"

Karthik Malla
  • 5,570
  • 12
  • 46
  • 89

1 Answers1

0

You are missing closing braces.. try this:

<script type="text/javascript">
$.noConflict();
$(document).ready(function () {
    $('.deleterd').on('click', function(){
        $(this).closest('div').remove();
    });
});
</script>
Abdul Jabbar
  • 2,573
  • 5
  • 23
  • 43