each

B. Yet Another Crosses Problem

杀马特。学长 韩版系。学妹 提交于 2019-12-01 04:57:13
B. Yet Another Crosses Problem time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given a picture consisting of n n rows and m m columns. Rows are numbered from 1 1 to n n from the top to the bottom, columns are numbered from 1 1 to m m from the left to the right. Each cell is painted either black or white. You think that this picture is not interesting enough. You consider a picture to be interesting if there is at least one cross in it. A cross is represented by a pair of numbers x x and y y, where 1 ≤ x ≤ n 1≤x≤n and 1 ≤ y ≤

wait for each jQuery

心不动则不痛 提交于 2019-12-01 03:51:29
I'm trying to make a div fade in/out that's within an each statement. The problem is that next item is called before the fade in/out is complete. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js" type="text/javascript"></script> <div id='one'>one</div> <div id='two'>two</div> <div id='three'>three</div> <script> $.each([ "one", "two", "three"], function() { console.log( 'start - ' + this ); animate( this ); console.log( 'end - ' + this ); }); function animate( id ) { box = '#' + id; $(box).fadeOut( 500, function( ) { console.log('showing - ' + id); $(box).fadeIn(

Jquery .each through Divs inside another Div

社会主义新天地 提交于 2019-12-01 03:39:31
I currently have the following html: Apologies for edit, I was not paying attention when i wrote this. <div class ="left"> <div>1</div> <div>2</div> <div>3</div> </div> I am using the JQuery .each command to iterate through each div using $('div').each . Although I only want to iterate through the divs inside the div with the class name 'left'. I have tried using $('.left > div').each but it did not work. Any help appreciated. $.each( $('.left'), function(i, left) { $('div', left).each(function() { }); }) Is this what you're lookng for? $('div.left>div').each(function(){ /* do stuff */ });

Get label for input field

寵の児 提交于 2019-12-01 03:17:57
I'm doing a validation with Jquery and need to get the $label from each element with their own label. Now the alert() gives med [object object]. The best thing for me here is to get an alert() with all fields lined up that is not filled out. And not an alert() for each. Here is a fiddle: http://jsfiddle.net/s7pYX/ How is this accomplished? HTML: <div> <label for="txtName">Name</label> <input type="text" id="txtName" class="form-control" name="txtName"> </div> <div> <label for="txtEmail">E-mail</label> <input type="text" id="txtEmail" class="form-control" name="txtEmail"> </div> Jquery: $(

Is it possible to use variable names dynamically in SASS each loop? [duplicate]

…衆ロ難τιáo~ 提交于 2019-12-01 03:03:37
This question already has an answer here: Creating or referencing variables dynamically in Sass 5 answers This is a simplified example. What I'd like to do is use the items in the array to output variable values I've previously created. The syntax below that tries create a variable by concatenating a '$' is obviously wrong but I'm using it to make it clear what I'm trying to do. $puma-width: 100px; $slug-width: 200px; @each $animal in puma, slug { .#{$animal}-title { width: $+#{$animal}-width; } } Desired output: .puma-title { width: 100px; } .slug-title { width: 200px; } That's something that

jquery each loop return false not end the function

元气小坏坏 提交于 2019-12-01 02:45:24
问题 I have a function which get a dot seperated string and parse it to array. And I want to loop these array elements and check a value is greater than 255 and return false, if not continue to function statements and return true as end of function. But it never stops the loop.. and always return true. Here is code: checkipAddress = function(value){//instance value: 999.999.999.999 result:true debugger var array = value.split('.'); $.each(array, function(index,val){ debugger if(parseInt(val)>255)

Looping through input fields for validation using Jquery each()

我的梦境 提交于 2019-12-01 02:11:34
I'm making a form and would like the code to execute only if the input values are numbers. I'm trying to avoid using some kind of validation plugin and was wondering if there is a way to loop through the input fields and check for the values. I've been trying the following but I think my logic is wrong: (#monthlyincome is the form id) $("#submit").click(function() { $("#monthlyincome input").each(function() { if (!isNaN(this.value)) { // process stuff here } }); }); Any ideas? This is the whole updated code: $("#submit").click(function() { $("#monthlyincome input[type=text]").each(function() {

How to use jQuery each() function within append()

假装没事ソ 提交于 2019-12-01 00:41:56
Maybe I'm just missing something simple, but it doesn't seem like anyone else has asked this question anywhere. I'm trying to create a new section of HTML nodes and would like to be able to do it all in a concise and chained manner. Basically I'd like to do something like this: var options = { buttons: { 'New': function() { /* Do some work*/ } 'Edit': function() { /* Do some work*/ } // etc. } }; $( '#container' ).append( $( '<div />', { 'class': 'table' } ).append( $( '<div />', { 'class': 'row' } ).append( function() { $.each(options.buttons, function(key, value) { $( '<button />', { text:

artTemplate渲染类树形数据结构

ぃ、小莉子 提交于 2019-11-30 21:48:08
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title></title> <style type="text/css"> </style> </head> <body> <table border="1px solid #ccc" style="border-collapse:collapse;" id="table"> <tr> <th>索引</th> <th>姓名</th> <th>证件类型</th> <th>证件号</th> <th>手机号</th> <th>出生日期</th> </tr> <tbody id="content"> </tbody> <tbody id="content1"> </tbody> </table> <div id="info" style="border: 1px solid #ccc; text-align: center; display: none;"> <p>编号:<span id="id"></span></p> <p>姓名:<span id="name"></span></p> <p>证件类型:<span id="iden"></span></p> <p>证件号:1111</p> <p>手机号:<span id="phone"></span></p> <p>出生日期:

Looping through input fields for validation using Jquery each()

懵懂的女人 提交于 2019-11-30 21:36:30
问题 I'm making a form and would like the code to execute only if the input values are numbers. I'm trying to avoid using some kind of validation plugin and was wondering if there is a way to loop through the input fields and check for the values. I've been trying the following but I think my logic is wrong: (#monthlyincome is the form id) $("#submit").click(function() { $("#monthlyincome input").each(function() { if (!isNaN(this.value)) { // process stuff here } }); }); Any ideas? This is the