jQWidgets jqxQRcode errorLevel Property
Last Updated :
22 Sep, 2022
jQWidgets is a JavaScript framework for making web-based applications for PC and mobile devices. It is a very powerful, optimized, platform-independent, and widely supported framework. The jqxQRcode is in version 14 of jQWidgets and is used to indicate a widget that can display QR codes as well as possesses API in order to approve, export, and also personalize them.
The errorLevel property is used to set or return the level of the error correction in the displayed jqxQRcode. It is of string type and its default value is H.
Syntax:
- Set the errorLevel property:
$('Selector').jqxQRcode({ errorLevel: "H" });
- Return the errorLevel property:
var errorLevel = $('Selector').jqxQRcode('errorLevel');
Linked Files: Download jQWidgets from the given link. In the HTML file, locate the script files in the downloaded folder.
<link rel=”stylesheet” href=”jqwidgets/styles/jqx.base.css” type=”text/css” />
<script type=”text/javascript” src=”scripts/jquery-1.11.1.min.js”></script>
<script type=”text/javascript” src=”jqwidgets/jqxcore.js”></script>
<script type=”text/javascript” src=”jqwidgets/jqxqrcode.js”> </script>
<script type=”text/javascript” src=”jqwidgets/jqxbuttons.js”> </script>
Example 1: The below example illustrates the jqxQRcode errorLevel property in jQWidgets.
HTML
<!DOCTYPE html>
< html lang = "en" >
< head >
< link rel = "stylesheet"
href = "jqwidgets/styles/jqx.base.css"
type = "text/css" />
< script type = "text/javascript" src =
"scripts/jquery-1.11.1.min.js" >
</ script >
< script type = "text/javascript"
src = "jqwidgets/jqxcore.js" >
</ script >
< script type = "text/javascript"
src = "jqwidgets/jqxqrcode.js" >
</ script >
< script type = "text/javascript"
src = "jqwidgets/jqxbuttons.js" >
</ script >
</ head >
< body >
< center >
< h1 style = "color:green" >
GeeksforGeeks
</ h1 >
< h3 >
jQWidgets jqxQRcode errorLevel Property
</ h3 >
< div id = "jqxq" ></ div >
< input type = "button" style = "margin:29px;"
id = "jqxbtn" value = "Click here" />
< div id = "log" ></ div >
</ center >
< script type = "text/javascript" >
$(document).ready(function () {
$("#jqxq").jqxQRcode({
errorLevel: "L",
});
$("#jqxbtn").jqxButton({
width: 280
});
$("#jqxbtn").on("click", function () {
var el = $('#jqxq').jqxQRcode('errorLevel');
$('#log').text(el);
});
});
</ script >
</ body >
</ html >
|
Output:
Example 2: The following is another example of the jqxQRcode errorLevel property in jQWidgets.
HTML
<!DOCTYPE html>
< html lang = "en" >
< head >
< link rel = "stylesheet"
href = "jqwidgets/styles/jqx.base.css"
type = "text/css" />
< script type = "text/javascript" src =
"scripts/jquery-1.11.1.min.js" >
</ script >
< script type = "text/javascript"
src = "jqwidgets/jqxcore.js" >
</ script >
< script type = "text/javascript"
src = "jqwidgets/jqxqrcode.js" >
</ script >
< script type = "text/javascript"
src = "jqwidgets/jqxbuttons.js" >
</ script >
</ head >
< body >
< center >
< h1 style = "color:green" >
GeeksforGeeks
</ h1 >
< h3 >
jQWidgets jqxQRcode errorLevel Property
</ h3 >
< div id = "jqxq" ></ div >
< input type = "button" style = "margin:29px;"
id = "jqxbtn" value = "Click here" />
< div id = "log" ></ div >
</ center >
< script type = "text/javascript" >
$(document).ready(function () {
$("#jqxq").jqxQRcode({
errorLevel: "M",
});
$("#jqxbtn").jqxButton({
width: 280
});
$("#jqxbtn").on("click", function () {
var el = $('#jqxq').jqxQRcode('errorLevel');
if (el === "M") {
$('#log').text("Medium!");
}
else {
$('#log').text("High or Low!");
}
});
});
</ script >
</ body >
</ html >
|
Output:
Reference: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxqrcode/jqxqrcode-api.htm?search=
Share your thoughts in the comments
Please Login to comment...