-1

I tried to popup partial view, but its not working ,this is my link

 <a id="id1" href="@Url.Action("index", "versus", new { matchid = c.MatchID })" target="_blank" data-toggle="tooltip" data-placement="top" 
                               title="@homeMLName - @awayMLName">
                                @homeMLName - @awayMLName
                            </a>

And this is my script:

<script>
 $('a#id1').click(function (event) {
    event.preventDefault();
    window.open($(this).attr('href'), '_blank');
});
</script>
Stat Tips
  • 5
  • 5
  • How is it "not working"? What does it do? How are these two pieces of code related? – David Oct 14 '17 at 10:27
  • It is not opening a popup,but a new window instead,this two pieces are connected with id – Stat Tips Oct 14 '17 at 10:29
  • (1) You had a typo which you've since corrected in the question. Do you have any more typos? Is this not really the code you're using? Or, if it is, have you tested it since making the correction? (2) What exactly do you think "a popup" is, if not a new window? I would expect this code to open a new window, which you claim it does, so what isn't working? – David Oct 14 '17 at 10:31
  • i corrected it because i had written "#aid1" instead of "a#id1",but that was not the problem – Stat Tips Oct 14 '17 at 10:33
  • Ok, so your code had a typo. That explains why it wasn't working before. But how is it not working *now*? Please clarify the problem. – David Oct 14 '17 at 10:34
  • it is still opening a new tab ,not a popup window – Stat Tips Oct 14 '17 at 10:35
  • Duplicate: https://stackoverflow.com/questions/12939928/make-a-link-open-a-new-window-not-tab – David Oct 14 '17 at 10:42

1 Answers1

0

This worked for me:

<a style="cursor:pointer;" data-toggle="tooltip" data-placement="top" title="@homeMLName - @awayMLName"
                               onclick="window.open('@Url.Action("index", "versus", new { matchid = c.MatchID})','_blank', 'targetWindow', 'menubar=no,scrollbars=yes,resizable=yes, width=600, height=650'); return false;">
                                @homeMLName - @awayMLName
                            </a>
Stat Tips
  • 5
  • 5