Semantic UI doesn't work at all - javascript

I know I must missed something because none of the example of works in my computer.
Take the simplest first example at the website.
I copied the code AS IS and it doesn't work at all for me. I included the semantic.min.css and semantic.min.js also just in case I included the jQuery using google CDN.
Following is my html code.
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="semantic/dist/semantic.min.css">
<script src="semantic/dist/semantic.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.3/jquery.min.js"></script>
</head>
<body>
<script>
$('.ui.dropdown')
.dropdown()
;
</script>
<div class="ui dropdown">
<input type="hidden" name="gender">
<i class="dropdown icon"></i>
<div class="default text">Gender</div>
<div class="menu">
<div class="item" data-value="male">Male</div>
<div class="item" data-value="female">Female</div>
</div>
</div>
</body>
</html>
The output is like this..
Thank you! I am pretty new to JavaScript and semantic UI.

i use this order of linking js files and work fine
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<script type="text/javascript" src="../bower_components/jquery/dist/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="../bower_components/semantic/dist/semantic.min.css">
<script src="../bower_components/semantic/dist/semantic.min.js"></script>
</head>
<body>
<select name="gender" class="ui dropdown" id="select">
<option value="">Gender</option>
<option value="male">Male</option>
<option value="female">Female</option>
</select>
<script type="text/javascript">
$('#select')
.dropdown()
;
</script>
</body>
</html>

I need to include jQuery before including .js and .css

Related

How can I call my Calculator to popup on click, at my website with a Javascript function?

My Index (PHP)
On <div class="button"> I need my onclick.
<html>
<head>
<script src="script.js"></script>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="form">
<input type="number">
<div class="button"> **Here I need the onclick popup call calculator**
<img src="https://www.iconarchive.com/download/i58919/wwalczyszyn/android-style-honeycomb/Calculator.ico"></img>
</div>
</div>
</body>
</html>
My Calculator is a php file called calculator.php followed by calculator.css and script.js

Simplest example of Select2 doesnt working

i'm trying to use Select2 select boxes, but it doesnt work on my page. My js skills is poor, so I try to do simplest example. I'm using bootstrap library. Whole code looking like:
<!DOCTYPE html>
<html lang="pl">
<head>
<meta charset="utf-8_polish_ci">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" integrity="sha384-9gVQ4dYFwwWSjIDZnLEWnxCjeSWFphJiwGPXr1jddIhOegiu1FwO5qRGvFXOdJZ4" crossorigin="anonymous">
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.6-rc.0/css/select2.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.6-rc.0/js/select2.min.js"></script>
<link href="../inc/bipro.css" rel="stylesheet" type="text/css">
<title>Test</title>
</head>
<body>
<br>
<div class="container">
<div class="row justify-content-center">
<div class="col-md-6">
<div class="card">
<div class="card-header">
select2
</div>
<div class="card-body text-center">
<select class="aaaa form-control">
<option value="">wybierz</option>
<option value="1">banany</option>
<option value="2">cytryny</option>
<option value="3">jabłka</option>
</select>
</div>
</div>
</div>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js" integrity="sha384-cs/chFZiN24E4KMATLdqdvsezGxaGsi4hLGOzlXwp5UZB1LY//20VyM2taTB4QvJ" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js" integrity="sha384-uefMccjFJAIv6A+rW+L4AHf99KvxDjWSu1z9VI8SKNVmz4sk7buKt/6v9KI65qnm" crossorigin="anonymous"></script>
<script>
$(document).ready(function() {
$('.aaaa').select2();
});
</script>
</body>
</html>
What am I doing wrong
You aren't including jQuery which is required for both Bootstrap and Select2.
<script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
Make sure jQuery is imported before Bootstrap and Select2
You're missing the name="" property on your select. I'd also rename that class to something that makes sense, like js-select
<select class="js-select form-control" name="fullnames">
<option value="0">wybierz</option>
<option value="1">banany</option>
<option value="2">cytryny</option>
<option value="3">jabłka</option>
</select>
Then your script will look like this:
<script type="text/javascript">
$(document).ready(function() {
$('.js-select').select2();
});
</script>

Checkbox in bootstrap label not working

I was trying to follow this tutorial to have checkboxes displayed as buttons for my angular app, but something wasn't working for me, the checkbox value does not change, and the onclick function is not called :
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-primary">
<input type="checkbox" onclick="alert('is not shown')"> Click me <!-- Here -->
</label>
</div>
</body>
</html>
But if I remove the boostrap.js script (or the class="btn btn-primary") it works :
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
</head>
<body>
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-primary">
<input type="checkbox" onclick="alert('is shown !')"> Click me
</label>
</div>
</body>
</html>
How do I make this working without removing the bootstrap.js script?
Add custom css for input
.btn-group input[type=checkbox]{
clip: initial !important;
cursor: pointer;
height: 29px;
left: 0;
opacity: 0;
pointer-events: initial !important;
top: 0;
width: 100%;
}
https://jsfiddle.net/xt3b88z2/
Just use onchange. Checkbox onchange should be more meaningful than onclick.
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-primary">
<input type="checkbox" onchange="alert($(this).is(':checked'))">Click me
</label>
</div>
</body>
</html>

External jquery is not working at load time

I am working in one task in that I want to create online visiting card in html. Now, at load times it looks like this in which I have draw the different shaped.
As per you see the first image I have draw the different shaped
In this second image when I am selecting a picture at that time shaped toolkit was hide and so from that I unable to create a shaped over an image.
So as per I research in my code I realized that jquery "initialize: function()" is not load after the selecting picture. So it can be said that at load time jquery is not excuting.
Here is my code,
<script type='text/javascript' src='js/jquery.min.js'></script>
<script src="js/kinetic-v3.9.3.js"></script>
<script type="text/javascript" src="js/version1.js"></script>
<link href="css/layout.css" rel="stylesheet" type="text/css"/>
<link rel="stylesheet" href="css/menu.css" type="text/css" media="screen" />
<!-- Menu -->
<!--[if lt IE 9]>
<link rel="stylesheet" type="text/css" href="css/ie/ie.css" />
<![endif]-->
<link rel="stylesheet" href="styles/global.css" type="text/css" media="screen" />
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/mobile.js"></script>
<script type="text/javascript" src="js/form.js"></script>
<script type="text/javascript" src="./lib/jquery.1.10.2.min.js"></script>
<!-- jquery -->
<script type="text/javascript" src="./Pixanova_files/jquery.min.1.9.0.js"></script>
<!-- backbone -->
<script type="text/javascript" src="./Pixanova_files/underscore.min.1.4.4.js"></script>
<script type="text/javascript" src="./Pixanova_files/backbone.min.0.9.10.js"></script>
<!-- wColorPicker -->
<link rel="stylesheet" type="text/css" href="./Pixanova_files/wColorPicker.css">
<script type="text/javascript" src="./Pixanova_files/wColorPicker.js"></script>
<!-- wPaint -->
<script type="text/javascript" src="./Pixanova_files/jquery.ui.core.min.js"></script>
<script type="text/javascript" src="./Pixanova_files/jquery.ui.widget.min.js"></script>
<script type="text/javascript" src="./Pixanova_files/jquery.ui.mouse.min.js"></script>
<script type="text/javascript" src="./Pixanova_files/jquery.ui.draggable.min.js"></script>
<link rel="stylesheet" type="text/css" href="./Pixanova_files/wPaint.css">
<script type="text/javascript" src="./Pixanova_files/wPaint.js"></script>
<!-- pixanova -->
<script type="text/javascript" src="./Pixanova_files/pixanova.js"></script>
<link rel="stylesheet" type="text/css" href="./Pixanova_files/pixanova.css">
<div id="wrapper">
<!--header-->
<div id="content">
<!-- container is the div id from where the image is display -->
<div id="container" style="width:600px; height:600px; float:right"> </div>
<script type="text/javascript">
var pixanova = new PixanovaView321();
</script>
<div id="editor">
<ul id="text" style="float: left; margin-right:10px;">
<!--<div id="spinner" class="spinner" style="display:none;margin-left:80px;margin-bottom:20px;"> Image Uploading<img src="images/ajax.png" alt="loading">
</div>-->
<div id="container2" style="width:140px;"> </div>
<li>
<label> </label>
<input type="submit" id="textsubmit" value="Add Text"/>
<select name="Choice" onchange="setImage(this);">
<option value="images/blue.jpg">Photo 1</option>
<option value="images/black.jpg">Photo 2</option>
<option value="images/red.jpg">Photo 3</option>
<option value="images/redplan.jpg">Photo 4</option>
</select>
<input type='file' />
</li>
</ul>
<p class="clearing" /></p>
</div>
</div>
</div>
<!--container-->
</body>
here the external pixanova.js code from where the toolkit has calling
//This variable is calling the PixanovaView321 function in pixanova.html
var PixanovaView321 = Backbone.View.extend(
{
initialize: function()
{
alert();
//Menu option
$('#container').wPaint({
menuOffsetX: 50,
menuOffsetY: 50,
menuOrientation: 'horizontal',
strokeStyle: "yellow"
});
},
});

How to add tax and grand total to my simplecart JS

Hello all I'm trying to use simplecart.js to create a custom checkout page for my website I want to add a simplecart_grandtotal but it doesn't seem to display. How can I go about doing that? My simple code is which i have taken from the demo http://wojodesign.com/simpleCart/myCart.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta charset="utf-8">
<script src="js/jquery-1.7.min.js"></script>
!window.jQuery && document.write('<script src="jquery-1.4.3.min.js"><\/script>');
</script>
<title>simpleCart (js) Demo</title>
<link rel="stylesheet" href="example.css" type="text/css" media="screen" charset="utf-8" />
<!--[if lte IE 6]><link rel="stylesheet" href="ie6.css" type="text/css" media="screen" charset="utf-8" /><![endif]-->
<!--[if IE 7]><link rel="stylesheet" href="ie7.css" type="text/css" media="screen" charset="utf-8" /><![endif]-->
<script src="simpleCart2.js" type="text/javascript" charset="utf-8"></script>
<!--Make a new cart instance with your paypal login email-->
<script type="text/javascript">
simpleCart.email = "yasdasb#gmail.com";
simpleCart.cartHeaders = ['Image','Name','Price','Quantity_input','Total'];
simpleCart.checkoutTo = PayPal;
</script>
<!--Include the SimpleCart(js) script
<script src="javascripts/simpleCart.js" type="text/javascript" charset="utf-8"></script>
Make a new cart instance with your paypal login email
<script type="text/javascript">
simpleCart = new cart("brett#wojodesign.com");
</script>-->
</head>
<body>
<div class="main">
<div id="content">
<div id="sidebar" style="margin-top:20px">
<h2>You Might Also Like</h2>
<div class="alsoContainer">
<div class="alsoImage">
<img src="images/thumbs/blackGold.jpg" alt="" />
</div>
<div class="alsoInfo">
Black Gold<br/>
add to cart
</div>
<div class="alsoPrice">$58</div>
</div>
<div class="alsoContainer">
<div class="alsoImage">
<img src="images/thumbs/goldShoe.jpg" alt="" />
</div>
<div class="alsoInfo">
Gold Shoe<br/>
add to cart
</div>
<div class="alsoPrice">$58</div>
</div>
<div class="alsoContainer">
<div class="alsoImage">
<img src="images/thumbs/greenStripe.jpg" alt="" />
</div>
<div class="alsoInfo">
Green Stripe<br/>
add to cart
</div>
<div class="alsoPrice">$58</div>
</div>
<!--End #sidebar-->
</div>
<div id="left">
<!--Add a Div with the class "simpleCart_items" to show your shopping cart area.-->
<div class="simpleCart_items" >
</div>
<div class="checkoutEmptyLinks">
<!--Here's the Links to Checkout and Empty Cart-->
empty cart
Checkout
</div>
</div>
<!--End #content-->
</div>
</div>
</body>
</html>
this demo not have all the code go to https://github.com/wojodesign/simplecart-js/blob/master/simpleCart.js and take from there.
and then you can add :
<div class="simpleCart_tax"></div>
<div class="simpleCart_taxRate"></div>
<div class="simpleCart_grandTotal"></div>
http://simplecartjs.org/documentation/displaying_cart_data

Categories