Javascript didn't load in my html - javascript

So i copy the codes from this website completely unchanged
-> enter code herehttp://jsfiddle.net/laelitenetwork/puJ6G/
But the button doesn't work for me. When i click the + and -, nothing happen to the number.
This is my code in the netbeans.
Is my netbean problem or something missing in the javascript?
the html, css and javascript

I am not entirely sure on what exactly you are asking but I understood it like that:
You want to use the code from the JSFiddle in your own project and it does not work.
If that is the case, I think you forgot to add a reference to JQuery in your code.
Add this to your HTML:
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
And see if that fixes your problem.
However if it does not fix it, please edit your post with the full code.

Related

Broken link - "/a" in JQuery 1.9 Js file

When we had done security audit of our project, we got broken Link "/a" vulnerability.
After searching for link throughout project we found link in JQuery-1.9.js java-script file that we are using in our project.
small part of code in that JQuery-1.9.js -
// Make sure that URLs aren't manipulated
// (IE normalizes it by default)
hrefNormalized: a.getAttribute("href") === "/a",
As per my understanding this code part helps for making it(JQuery) compatible with IE 6/7/8.
hrefNormalized is used to check that anchor tag is giving href value as full URL or exact href , which is issue in IE version.
The better explanation of this part is given in
https://www.inkling.com/read/jquery-cookbook-cody-lindley-1st/chapter-4/recipe-4-1
I want to remove this vulnerability but i don't want to remove or change code in JQuery js file.
So, My question is why did not JQuery designers used "/#" instead of "/a" .What is the problem of using "/#" in that code.
Earlier same question is asked by someone to JQuery Team,but they told that it not the problem from Jquery.
For reference of that ticket
http://bugs.jquery.com/ticket/10149
Help me to solve Or Is there another solution?
Thank you
This is not a vulnerability but a false positive. The security scanner interprets the "/a" string as a link, which it is not.
Even if jQuery creates the link in the DOM, it's not clickable or visible to the user. Your website does not actually have a real link to /a anywhere.
I would ignore the problem without changing anything.
Maybe, if you want this hrefNormalized: a.getAttribute("href") === "/a", to be transformed into this hrefNormalized: a.getAttribute("href") === "/#", but you don't want to touch the jQuery file.
Put that second one in a script in a an order so that the browser reads your script after reading the jQuery file, so it mashes.
Anyway, I never had issues with jQuery before, check your code first.
If you don't want to have your views with scripts, put it in a js file and link this file to your view after the jQuery file.
Hope it helped you, or at least gave you some ideas to solve your problem. Good luck, let us know how it goes! ;)
EDIT:
<script src="~/JQuery/jquery-2.0.3.js"></script>
<script src="~/Scripts/Fix.js"></script>
If you do something like this, the browser reads first the jQuery, then it reads the Fix.js. Inside the Fix.js, you put the function or paramater you want to change from the jQuery.
So the Browser will get the latest one it reads if they are equal.
For example:
function whatever (){ //This in jQuery file
//things #1
}
function whatever (){ //This in Fix file
//Different things #2
}
This way the browser chooses the Fix.js one, because was the last he read.

How to use HTML5 code tag to beautify code

Does anyone have an example on how to use HTML5 code tag in order to display HTML code?
I tried to do that but it failed.
Afterwards, I tried to use highlight.js but still no luck.
Any suggestions?
Demo
The HTML code tag has nothing to do with beautifying. It simply indicates its content as computer code, and by default it causes it to be rendered in a monospace font. That’s all.
To get help with beautification, I suggest that you open a new question and post your best effort so far (not links to general resources but to code that you actually tried) and explain what you wish to achieve.
You would need to replace < tag with < and > with >. Only by escaping these characters can you see the html code

How Scale text to parent div plugin problems

I've been trying to make this script work for an hour with zero luck.
Heres the proper jsfiddle: http://jsfiddle.net/zachleat/WzN6d/
Here's my website where the broke code is:
http://designobvio.us/dov2/index.html
I'm totally novice with javascript/jQuery. Please forgive me if this is a retarded semantics problem.
thank you
Looks like you are missing the document.ready try adding the following.
$(function(){
$('#bigtext').bigtext();
});
jsfiddle does this for you automatically, thats why you don't need it there.

Part of jQuery code missing?

I am using colorbox which I have used many times for different clients, but it is not working this time and I can not figure out why. I am trying to open a video on YouTube, and then open up some inline HTML, I've copied the code from the examples just as I always do, and replaced what needs to be replaced. There are parts of the script that are missing when I look at the source code from the browser. The website is http://www.powerhousebowling.com. Maybe I'm missing something.
In my backend it looks like this:
<script type="text/javascript">
$(document).ready(function(){
$(".youtube").colorbox({iframe:true, innerWidth:425, innerHeight:344});
$(".open_colorbox").colorbox({width:"50%", inline:true, href:"#inline_text"});
});
</script>
But when I look at the source code in FF or IE it shows...
<script type="text/javascript">
$(document).ready(function(){
$(".youtube").colorbox();
$(".open_colorbox").colorbox();
});
</script>
If the code you are mentioning is inputed in some kind of backend, the software or the server is probably striping the code for security reason. See what happens if you remove de curly brackets and if the code appears then try finding how to insert them following the software's rules ({literal}{/literal} if it is a Smarty template)
I finally found out what was happening about a week ago, sorry for the delay in answering, I was out of the office. The CMS that we use, ExpressionEngine, was thinking anything between the curly brackets were tags for itself, I took the script outside the CMS and pointed to it, works fine! Hope this helps anyone else!

DOM based scripting

ok so here's my problem...
i've been following this tutorial ( http://www.alistapart.com/articles/dropdowns )
to make a css drop down menu with my wordpress blog. everything works fine... except in IE6.
now i know this is normal, and in the link i posted above there is a fix of this which makes use of DOM based scripting... is this java script?
the main question i have is.. where do i paste this code into? css, html, make a new file?
i'm new to any form of javascript.. it's boggling me a bit..
any help would be great!
Thanks!
yours truly
noobie
Yes, it is JavaScript.
As such, you can place it in a <script> block, preferrably inside <head>. (It assigns itself to window.onload, so the code will be executed at onload, no matter where in the page you put the code)
the main question i have is.. where do i paste this code into? css, html, make a new file?
I suggest you take a look at the source of this sample page:
http://www.htmldog.com/articles/suckerfish/bones/. It shows the bare details of how it's implemented.
i'm new to any form of javascript.. it's boggling me a bit..
I would like to suggest you read this nice tutorial which already helped out numerous developers during the years: w3schools.com/js.
Grz, Kris.

Categories