jQuery, selecting element that contains a specified string while not containing other

I am using :contains() to find strings in a large page of text content, and all of the repeating blocks will contain strings unique to those blocks, such as a student ID. I want to combine :contains() with :not(:contains()).

The logic is as follows:
If string contains 1234, but the word “absent” is not present, append award statement

jQuery, selecting element that contains a specified string while not containing other

while loop never completes

The objective of my program is to:

Write an application to pre-sell a limited number of private concert tickets. Each buyer can buy as many as 6 tickets. No more than 75 tickets can be sold. Implement a program that prompts the user for the desired number of tickets and then displays the number of remaining tickets. Use a while loop in your implementation. Repeat until all tickets have been sold, and then display the total number of buyers.

I seem to be having a problem with my loop closing, because even when the loop variable gets to its condition limit it still prompts for the number of tickets. Any idea why?

import java.util.Scanner;

public class TicketCounterHorn {

  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);

    int ticketsToBuy;
    int totalTickets =75;
    int buyers = 0;
    int ticketMax = 6;

    while (totalTickets >= 0) {
        System.out.print("How many tickets would you like to purchase: ");
        ticketsToBuy = in.nextInt();

        if (ticketsToBuy <= ticketMax && ticketsToBuy > 0) {

            if (ticketsToBuy < totalTickets) {
                totalTickets = totalTickets - ticketsToBuy;
                buyers++;
                System.out.println(ticketsToBuy);
                System.out.println(buyers);
                System.out.println(totalTickets);
            }
        }
    }

    System.out.println("the total number of buyers is: " + buyers);
  }
}

read more

jQuery/javascript – change image based on dropdown selection

I have an existing ecommerce page where I have this code for a dropdown menu:

<select data-optgroup="10201" class="prodoption detailprodoption" onchange="updateoptimage(0,0)" name="optn0" id="optn0x0" size="1"><option value="">Please Select...</option><option value="102011" class="">Small</option>
<option value="102012" class="">Medium</option>
<option value="102013" class="">Large</option>
<option value="102014" class="">XL</option>
<option value="102015" class="">2XL (+$3.00)</option>
<option value="102016" class="">3XL (+$5.00)</option>
<option value="102017" class="">4XL (+$7.00)</option>
<option value="102018" class="">5XL (+$7.00)</option>
</select>

read more

jQuery/javascript – change image based on dropdown selection

I have an existing ecommerce page where I have this code for a dropdown menu:

<select data-optgroup="10201" class="prodoption detailprodoption" onchange="updateoptimage(0,0)" name="optn0" id="optn0x0" size="1"><option value="">Please Select...</option><option value="102011" class="">Small</option>
<option value="102012" class="">Medium</option>
<option value="102013" class="">Large</option>
<option value="102014" class="">XL</option>
<option value="102015" class="">2XL (+$3.00)</option>
<option value="102016" class="">3XL (+$5.00)</option>
<option value="102017" class="">4XL (+$7.00)</option>
<option value="102018" class="">5XL (+$7.00)</option>
</select>

read more

Why does my python loop not work when inputs match?

The python loop below doesn’t always seem to work. The code is meant to loop back to the beginning when either a == b or a and don’t match the regex. When a and b do indeed match the regex and the inputs are different the code will work. Or if a or don’t match the regex, the code will work and will loop properly – but as soon as a == b the code doesn’t work. I can confirm the regex works fine, however, when a and match – the code keeps on asking the user to input a and however does not proceed to do anything else. It will still print ‘i’ but afterwards will just request the user to enter input a and continuously no matter what is entered, like so:

read more