0

Hello

The meaning of this.id is self explanatory: element with currently focused on ID, but due to the abundance of the word "this", it is very difficult to find it in online js references, like w3schools.

could someone post a link to the explanation of this id somewhere on the net?

**

It will help me deal with a specific problem.

The problem is how to replace "this.id" with specific id reference. To narrow down my question, what does this.id refer to in the particular instances below and how could reference to it be made more directly, something like

replacethisses="#particularID"
?

var itemlista1;
var itemlista2;

var mapa1 = { item1zest1 : itemlista1, item1zest2 : itemlista2 };

$('#item1zest1, #item1zest2').change(function(){
$("#wybierzitem1 option").remove();
[COLOR="Red"]$.each(mapa1[this.id], function(i, val) {[/COLOR]
var opcja = $("<option />");
chayn1 = val
var cutted=chayn1.split("|");
var singl=cutted.slice(0,1);
opcja.appendTo($("#wybierzitem1")).text(singl);
$('#wybierzitem1').trigger("change")
});

var versionesel = $("#wybierzitem1");
var droplista = Math.floor(Math.random() * $('#wybierzitem1 option').length);
  versionesel.get(0).selectedIndex = droplista;
  versionesel.selectmenu('refresh', true);
var itemwybrany = $('#wybierzitem1').val(); 

[COLOR="Green"]  versioneFOR1=(mapa1[this.id][droplista]); [/COLOR]

$("label[for='itempick1'] .ui-btn-text").html(itemwybrany);
});


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

var itemwybrany = $('#wybierzitem1').val();   
$("label[for='itempick1'] .ui-btn-text").html(itemwybrany);
var itemwybrakowany = $('#wybierzitem1')[0].selectedIndex;

Edited by heftor

2
Contributors
2
Replies
15
Views
4 Years
Discussion Span
Last Post by heftor
0

this can reffer to two things, one is from jQuery, it's the element that you want to affect. The other one is that i can be from a class and you can reffer as this to another function from the same clasee.

In your case it is the first one that reffers to the element that is in your scope.
this is a DOM element and id is the ID of the element.

Edited by Szabi Zsoldos

0

and what are the names of this reference made by "this"? I would like to read about it online, but donot know how to call it.
I would be interested both in "this" for jq and "this" for DOM.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.