This is my scenario. I am creating image upload using an iframe. The situation is like this, if someone hovers over that iframe, another div opens on it which has two buttons. One button is to select another image another is to clear the image present in iframe.
This is the code of the view:
@using (Html.BeginForm("Index", "LandingSetting", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
@Html.ValidationSummary(true)
<div id="menu" class="tip_trigger">
<iframe width="731" height="335" src="@ViewData[" htmlloc "]"></iframe>
<div id="inner" class="hover-text">
<table>
<tr>
<td width="50%" align="center" valign="middle">
<img id="slctbtn" src="../../Images/Landing/s_btn.PNG" />
</td>
<td width="50%" align="center" valign="middle" style="padding-left: 200px">
<img id="clearbtn" src="../../Images/Landing/c_btn.PNG" />
</td>
</tr>
</table>
</div>
</div>
}
Here is the code for hover:
<script type="text/javascript">
$(document).ready(function () {
//Tooltips
$(".tip_trigger").hover(function () {
tip = $(this).find('.hover-text');
tip.show(); //Show tooltip
}, function () {
tip.hide(); //Hide tooltip
});
//
});
</script>
and here is the code for the two buttons:
<script type="text/javascript">
$(function () {
$('#slctbtn').click(function () {
$('#htmla').click();
});
$('#htmla').change(function () {
$('form').submit();
});
$('#clearbtn').click(function () {
$(this).load('@Url.Action("Clear", "LandingSetting")');
alert('Content Cleared!');
window.location.reload(true);
});
});
</script>
Note: htmla is the hidden input type file
This is my controller code:
public ActionResult Clear()
{
System.IO.File.Delete(Request.MapPath("/CSS/html/imgs/ex1.jpg"));
return RedirectToAction("Index");
}
The problem is this works fine in other browsers except IE8.Only the hover code is working in IE8. I need to make it specifically work in IE8. Can anybody help with that? Thanks
Note: In IE the click event is getting triggered because i can see the alert but it doesnt trigger @url.action method