0

I am getting the value of pop up after I clicked it. It is giving value on Chrome, but it will not work on Firefox, why?

Here is my fiddle.

These are the following steps I did:

  1. Click on test button (open pop up).
  2. Select any value of pop up show on alert.

On Chrome it shows, but on Firefox it gives "undefined".

$(function () {
  $('#test').click(function () {
      $("#commadsPopup").popup("open");
  });
});

$(document).on('click', '.commandRow a', function() {
    var str = this.innerText;
    alert(str);
});
Qantas 94 Heavy
  • 15,750
  • 31
  • 68
  • 83
  • The duplicate is the plain JS solution, but if you're using jQuery, just use [`$(this).text()`](http://api.jquery.com/text/) -- solving cross-browser headaches is exactly what jQuery is for. – apsillers May 07 '14 at 09:29

2 Answers2

1

Try to use textContent instead:

var str = this.textContent;

or apply jQuery using .text():

var str=  $(this).text();
Felix
  • 37,892
  • 8
  • 43
  • 55
0

innerText is not supported by Firefox! Internet Explorer introduced element.innerText.
Use textContent instead

MDN: textContent - Differences from innerText

Dharman
  • 30,962
  • 25
  • 85
  • 135