Pomster Pomster - 1 year ago 105
jQuery Question

e.srcElement is undefined in firefox?

I am developing a website and now am testing in all browsers, I am currently testing in firefox and have found and error when using event.sourceElement?

What i need e.srcElement to do is return values, a bit below i show an example on how i get the value PropID returned.

I have written a Jquery function that uses the e.srcElement and it looks as follows:

$(function () {
$(".DownloadLink").click(function (e) {

var PropID = getParameterByName("PropID", e.srcElement.search),
Token = getParameterByName("Token", e.srcElement.search),
TrackingNumber = getParameterByName("TrackingNumber", e.srcElement.search);

$.post("Valuation", { PropID: PropID, Token: Token, TrackingNumber: TrackingNumber}, function (taskId) {

// Init monitors

$("#dialog-modal").append($("<p id='" + taskId + "'/>"));
updateMonitor(taskId, "Started");

// Periodically update Modal
var intervalId = setInterval(function () {
$.post("Progress", { id: taskId }, function (progress) {
if (progress < 50) {
updateMonitor(taskId, "Building File");
} else if (progress == 50) {
updateMonitor(taskId, "Uploading File to FormMobi");
} else if (progress >= 100) {
updateMonitor(taskId, "Complete");
window.location.href = "downloadcomplete";
}, 100);

example of how e.srcElement works:

While testing in chrome and using the inspect element i can find that the following line returns:

Line of code:

PropID = getParameterByName("PropID", e.srcElement.search)

Returned result:


And so i can get the PropID result needed.

Is there some other why for me to return the values needed? Or
How can i get e.srcElement to work in fireFox?

Answer Source

in firefox simply call e.target to work. instead of e.srcElement[which works only in IE]