I have a function in jquery as below

function findMax(){
 $( ".elements" ).each(function( ) {
  if($(this).css('z-index')>max1)
  max1=$(this).css('z-index');
  max1=parseInt(max1);
 });
}

I have to implement this function in Dart Language. Facing problems with syntaxes in using .each function and 'this' function.

有帮助吗?

解决方案

The equivalent of jQuery :

$(".elements").each(function( ) {
  // do something with this being one of elements with a 'elements' class
  // you can access the current element with $(this)
});

is in Dart :

querySelectorAll('.elements').forEach((Element e) {
  // do something with e being one of elements with a 'elements' class
  // you can access the current element with e
});
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top