Answer the question
In order to leave comments, you need to log in
How to get the attributes of an element found among elements with the same class?
Hello, I ran into a problem and have not yet been able to "beautifully bypass" it.
There are HTML elements
<ul>
<li><a href="events" class="btn-menu">1</a></li>
<li><a href="about" class="btn-menu">2</a></li>
<li><a href="gallery" class="btn-menu">3</a></li>
<li><a href="connection" class="btn-menu">4</a></li>
<li><a href="teachers" class="btn-menu">5</a></li>
<li><a href="cooperations" class="btn-menu">6</a></li>
</ul>
jQuery(document).ready(function($) {
$('.btn-menu').on('click', function(event) {
event.preventDefault();
// получаем адрес для загрузки.
var href = './a_vie/content/' + $(this).attr('href') + '.php';
// закрываем меню
var e = jQuery.Event( "click" );
$( ".cd-close" ).trigger( e );
$('#modal-about').modal({
remote: href
});
});
});
Answer the question
In order to leave comments, you need to log in
Read immediately with a large block into an array, then process the array. And so on until the end of the file.
Buffered input in the standard library does the same thing, but if you embed it in your code, you can still save a little. If you allocate an array of a large enough size, then it may be possible to process the file in one read operation.
In the first while, the if condition is superfluous, this is the first thing you come across.
int count = 0;
int possible = 0;
int loop = 1;
while (loop) {
switch (getchar()) {
case '<':
possible = 1;
break;
case '>':
if (possible) {
count++;
}
possible = 0;
break;
case '*':
possible = 0;
break;
default:
loop = 0;
break;
}
}
Why all these long arrays? just looking for <> pairs:
int count = 0;
for(char last = 0, c = getchar(); c != '\n'; c = getchar())
{
if (last == '<' && c == '>') ++count;
last = c;
}
printf("%d\n",count);
In fact, the problem is in modal windows that load content asynchronously. (In case there are several callers attached to the same modal window class)
Before initializing the output of a new modal window, clear the cache:
$('#modal').removeData();
Or ban at a higher level.
$.ajaxSetup({
cache: false
})
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question