Trying to understand the jQuery('#none') selector [closed] - javascript

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 1 year ago.
Improve this question
I am working on a small project for work and I came across a piece of code that is iterating a counter, and if that counter is not 0 then it executes this small bit of code:
if (cnt) jQuery('#none').prop('checked', false);
I am trying to understand what the jQuery('#none') selector is. When I execute it alone as just a selector within the chrome console, it returns an empty set. I have been googling for about 30 minutes, searching jQuery/JavaScript/CSS docs and all I can find are a few references to things where people are using this selector, but the topic in question is not in regard to the selector itself. To me this line appears to be doing literally nothing as commenting it out does not seem to change the behavior.
I really prefer to not mess around with stuff I don't understand as that almost always results in bugs. Can anyone point me to some documentation or just explain here what the #none selector is?
EDIT:
It would appear there is no magic #none selector. My assumption is this was left over from a previous iteration, it threw me off since the person who originally wrote it does not write erroneous code like this and I was finding people using the same selector online with no explanation - but those instances were red herrings.

jQuery('#none') selects all elements where id=none. If there are no elements with the id of "none", then it will return an empty set.
<div id=none>This div has the id = "none"</div>
It sounds like you found a piece of 'cruft' (aka zombie code).

Related

Dynamically reordering DIV elements [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 7 years ago.
Improve this question
I recently started studying html, css and javascript since I'm quite interested in being able to create my own news website and I realized that I don't really know how to accomplish the following thing :
I want my website's homepage to have 10 div blocks and every one of them to have a headline with hyperlink to the corresponding html page. However, when I add a new div, I want the bottom div block disappear so it can make room for the newest div that's gonna be on top.
To be quite honest I have no idea what I need to study to accomplish this. Here's an image depicting what I want to accomplish.
Can you throw me a brief explanation or some keywords for me to google in order to understand how to do that?
This is a bit of a tricky question without knowing precisely how you want the items (the div elements you mentioned) to be added.
If you are adding these items to the set dynamically (without reloading the entire page), then you may want to use the overflow property of the container of these items. This way, you can keep the items that were already in the set from disappearing as someone is about to visit them.
Otherwise, if you plan on only loading the latest items in your database when the page is visited, you will simply have to use the correct queries to return only the correct amount (the amount that fits in your "set") of most recent data from your database.
I should probably mention that building this website from the ground up without any help will be quite the challenge for a beginner. Especially since you will have to do all of the back-end work as well to set up your database. I'd advise seeking help from someone with experience in this area if you can, because it wouldn't be much fun to start off in the wrong direction and have to completely restart!

What do you call this bug and is it a CSS, JS, library bug? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
I have this bug happening in my site where my menu drops down and instead of being render on top there is this one area that is under the table.
I am looking for an answer but am not sure exactly what is the bug called, or if it is a CSS, java script, or library problem. The menu is created using Kendo Ui and the table/Grid is created using JqxGrid. If you guys can help me identify the name of this behavior it will help me a lot in finding the solution. Or if you know the reason that is even better. Before I show code I would like to try to solve this on my own. Thank you.
It looks to me like an issue with your CSS. The row of the grid you have is at a higher z-index than your menu. In my experience the best thing to do is to explicitly (where possible) give your menu items z-indices higher than anything else you have on the page (or would want). eg. if your highest z-index is 100, use 1000 for the menu.

Make all instances of part of word italic [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I'm using expressionengine as a CMS, after the page is loaded, I need to find 'arbesthealth' and make it ar*best*health, What would be the best way to do this? Jquery after document ready? can it be done with CSS?
note: I can't do it on the cms side because EE doesn't allow tags inside the title fields so it needs to be done on output. I guess I could do it with a substr in php, but I'm just curious to the other ways that this would be possible.
The simple solution would be to manipulate innerHTML (directly, or through jQuery's html function), but that will destroy and recreate all of the elements, which isn't ideal — not least because any event handlers attached to them will get removed.
But a simple recursive function processing text nodes and inserting strong elements as necessary isn't difficult. My answer to this other SO question shows how to do that, walking through the text nodes and using Text#splitText to split them up and insert elements. Sounds like a lot more work than it is.
Wrap a tag inside the word like this:
$('.content').wrapInTag({
words: ['best'],
tag: '<span>'
});
See FIDDLE
I added in .content but you can add it wherever the cms has the container
*UPDATE*
As mentioned this will effect all so lets try this method:
html().replace
SPECIFIC FIDDLE

Find your pokemon - how does it work? JS [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
So I found this site http://pokemon.step.lv/
If you type in your name and surname, it gives you your pokemon. I was just wondering, if somebody tells me which pokemon they are, is it possible for me to figure out their name?
I don't want to use it in any bad way, I'm just really curious, I tried to find something in this code http://www.google-analytics.com/urchin.js but I'm just a beginner at programming in general so it's pretty difficult for me, but it also makes me more interested in it.
If anyone is bored enough to try to help me, please just take a look
I'm not sure how many pokemon there are. But I know there are fewer pokemon (men)? than there are names.
There's something called the pigeonhole principle that states, essentially, if you have n pigeons, and n-1 pigeonholes, each pigeon can't have its own hole. It's the same thing with names. Since there are more names than there are pokemon, there must be people who share the same pokemon. Thus, the answer is no, it's impossible.
There is an array of pokemons. Server side script calculates hash-code from your name and gets an element from this array according to this hashcode. An arbitrary logic can be applied here, to generate array index from this hashcode.

Abort clock script execution on the page [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I have a particular problem. There is a page with a clock, i need to stop them. I've tried something like throw new Error() or infinite/recursive loops, didn't help. This is not my site or script so i can't change anything, is there any way to stop them from firebug/chrome console?
This will stop any clocks whose compenents are contained in the DOM:
document.removeChild(document.documentElement);
This will probably work in most cases, but it is possible that the clock script will clear and redraw the clock on the document element with every iteration. If so, this is the most effective option I can think of:
window.close();
These might be overkill for your purposes, but unless you include more details about the clock or give a demo link, I can't really tell you anything more specific.
Well, actually Disable JavaScript did what i need, without removing/reloading the page.

Categories