Skip to content
Advertisement

Avoid change of a select input

Is there a way of not letting users change a select input?. I have a form with an already selected option, and I want to aware users that they are doing that and I was trying to do this. I have a select with id=users: One of the problems I have is that it only happens if I click on

What does [object Object] mean? (JavaScript)

One of my alerts is giving the following result: What does this mean exactly? (This was an alert of some jQuery object.) Answer It means you are alerting an instance of an object. When alerting the object, toString() is called on the object, and the default implementation returns [object Object]. If you want to inspect the object, you should either

What JavaScript syntax highlighter does GitHub use?

What syntax highlighter is GitHub using on their site to display the code when you click on the file names? Answer As this help page of GitHub.com says, they’re using the Linguist library, which is written in Ruby. Linguist’s highlighters for each language are within vendor/grammars. And a list of supported languages can be found here, here, and here.

JavaScript shorthand ternary operator

I know that in PHP 5.3 instead of using this redundant ternary operator syntax: …we can use a shorthand syntax for our ternary operators where applicable: And I know about the ternary operator in JavaScript: …but is there a shorthand? Answer Something like that what you’re looking for, where it defaults if undefined? By the way, this works for a

HTML Select: How can you change the label when the is closed?

Consider this: The HTML above looks like #1 when open, and #2 when closed. How can I get the closed version to look like #3? The purpose is to also show the selected year without repeating it in the open options (so it looks cleaner). Answer My original (marked correct) answer is too old to be of use, so here

Use CMYK on web page

I need to use CMYK colors on my web page. Is there any way to use CMYK in CSS or may be convert CMYK to RGB using JavaScript? EDIT: I mean I have colors creating algorithm in CMYK notation and I need to use it on web page. Answer There is no perfect algorithmic way to convert CMYK to RGB.

How do I remove properly html5 audio without appending to DOM?

With Javascript, I have a function that creates an audio element with createElement(“audio”), and start playing in loop without using appendChild(), I mean without appending it to the DOM. The element created is kept in a variable, let’s called it music1: What I would like to do, is to change the music played, if possible using the same function, and

Logical operator in a handlebars.js {{#if}} conditional

Is there a way in handlebars JS to incorporate logical operators into the standard handlebars.js conditional operator? Something like this: I know I could write my own helper, but first I’d like to make sure I’m not reinventing the wheel. Answer This is possible by ‘cheating’ with a block helper. This probably goes against the Ideology of the people who

Advertisement