None
None

Reputation: 9247

How to open modal after i choose image?

What I want is when user choose image to open modal where it will have option to crop his image. This is my Fiddle where he can crop image but at view.

  <input type='file' id="imgInp" />
  img id="blah" class="crop" src="#" alt="your image" />
  <input type="hidden" id="x" name="x" />
  <input type="hidden" id="y" name="y" />
  <input type="hidden" id="w" name="w" />
  <input type="hidden" id="h" name="h" />

Upvotes: 0

Views: 626

Answers (2)

xhulio
xhulio

Reputation: 1103

Watching your fiddle you should know that you were close enough. Just do the following.

$("#imgInp").change(function(){
     console.log(this);
     readURL(this);
     $("#yourModal").modal('show);
});

Upvotes: 1

Sagar Arora
Sagar Arora

Reputation: 1783

Instead of using $("#yourModal").show(); use $('#yourModal').modal('show');

Use the following code:

      $('#imgInp').change(function(){

        $('#yourModal').modal('show');

      });

This will definitely work for you.

Upvotes: 0

Related Questions