I'm trying to to parse some text from a website using jsoup, but unfortunately the <div> has no classname. I' just learning jsoup and I don't know which function of jsoup will help me parse text from such a <div>.
Example:
<div>
....
...
.....
</div>
Right now I'm only able to fetch text from <div> with classname
Code:
document= Jsoup.connect(url).get();
Elements element = document.select("div[class=pandora]");
openBox = element.text();
HTML from jsoup.org:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Lyrics to "Nuh Ready Nuh Ready" song by Calvin Harris: Mi and di mandem We haffi run from half of di gyal dem So sweet, so sweet Don't want mi children and...">
<meta name="keywords" content="Nuh Ready Nuh Ready lyrics, Calvin Harris Nuh Ready Nuh Ready lyrics, Calvin Harris lyrics">
<meta name="robots" content="noarchive">
<meta property="og:image" content="//www.azlyrics.com/az_logo_tr.png">
<title>Calvin Harris Lyrics - Nuh Ready Nuh Ready</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<link rel="stylesheet" href="//www.azlyrics.com/bsaz.css">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<script type="text/javascript">
ArtistName = "Calvin Harris";
SongName = "Nuh Ready Nuh Ready";
function submitCorrections(){
document.getElementById('corlyr').submit();
return false;
}
</script>
</head>
<body>
<!-- Begin comScore Tag -->
<script>
var _comscore = _comscore || [];
_comscore.push({ c1: "2", c2: "6772046" });
(function() {
var s = document.createElement("script"), el = document.getElementsByTagName("script")[0]; s.async = true;
s.src = (document.location.protocol == "https:" ? "https://sb" : "http://b") + ".scorecardresearch.com/beacon.js";
el.parentNode.insertBefore(s, el);
})();
</script>
<noscript>
<img src="https://sb.scorecardresearch.com/p?c1=2&c2=6772046&cv=2.0&cj=1" alt="">
</noscript>
<!-- End comScore Tag -->
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.3";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<nav class="navbar navbar-default navbar-static-top noprint">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#search-collapse">
<span class="glyphicon glyphicon-search"></span>
</button>
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#artists-collapse">
<span class="glyphicon glyphicon-th-list"></span>
</button>
<a class="navbar-brand" href="//www.azlyrics.com"><img alt="AZLyrics.com" class="pull-left" style="max-height:40px; margin-top:-10px;" src="//www.azlyrics.com/az_logo_tr.png"></a>
</div>
<ul class="collapse navbar-collapse nav navbar-nav" id="artists-collapse">
<li>
<div class="btn-group text-center" role="group">
<a class="btn btn-menu" href="//www.azlyrics.com/a.html">A</a>
<a class="btn btn-menu" href="//www.azlyrics.com/b.html">B</a>
<a class="btn btn-menu" href="//www.azlyrics.com/c.html">C</a>
<a class="btn btn-menu" href="//www.azlyrics.com/d.html">D</a>
<a class="btn btn-menu" href="//www.azlyrics.com/e.html">E</a>
<a class="btn btn-menu" href="//www.azlyrics.com/f.html">F</a>
<a class="btn btn-menu" href="//www.azlyrics.com/g.html">G</a>
<a class="btn btn-menu" href="//www.azlyrics.com/h.html">H</a>
<a class="btn btn-menu" href="//www.azlyrics.com/i.html">I</a>
<a class="btn btn-menu" href="//www.azlyrics.com/j.html">J</a>
<a class="btn btn-menu" href="//www.azlyrics.com/k.html">K</a>
<a class="btn btn-menu" href="//www.azlyrics.com/l.html">L</a>
<a class="btn btn-menu" href="//www.azlyrics.com/m.html">M</a>
<a class="btn btn-menu" href="//www.azlyrics.com/n.html">N</a>
<a class="btn btn-menu" href="//www.azlyrics.com/o.html">O</a>
<a class="btn btn-menu" href="//www.azlyrics.com/p.html">P</a>
<a class="btn btn-menu" href="//www.azlyrics.com/q.html">Q</a>
<a class="btn btn-menu" href="//www.azlyrics.com/r.html">R</a>
<a class="btn btn-menu" href="//www.azlyrics.com/s.html">S</a>
<a class="btn btn-menu" href="//www.azlyrics.com/t.html">T</a>
<a class="btn btn-menu" href="//www.azlyrics.com/u.html">U</a>
<a class="btn btn-menu" href="//www.azlyrics.com/v.html">V</a>
<a class="btn btn-menu" href="//www.azlyrics.com/w.html">W</a>
<a class="btn btn-menu" href="//www.azlyrics.com/x.html">X</a>
<a class="btn btn-menu" href="//www.azlyrics.com/y.html">Y</a>
<a class="btn btn-menu" href="//www.azlyrics.com/z.html">Z</a>
<a class="btn btn-menu" href="//www.azlyrics.com/19.html">#</a>
</div>
</li>
</ul>
<div class="collapse navbar-collapse" id="search-collapse">
<form class="navbar-form navbar-right search" method="get" action="//search.azlyrics.com/search.php" role="search">
<div class="input-group">
<input type="text" class="form-control" placeholder="" name="q" id="q">
<span class="input-group-btn">
<button class="btn btn-primary" type="submit"><span class="glyphicon glyphicon-search"></span> Search</button>
</span>
</div>
</form>
</div><!-- /.navbar-collapse -->
</div><!-- /.container -->
</nav>
<!-- top ban -->
<div class="lboard-wrap noprint">
<div class="container">
<div class="row">
<div class="col-xs-12 top-ad text-center">
<span id="cf_banner_top_nofc"></span>
</div>
</div>
</div>
</div>
<!-- main -->
<div class="container main-page">
<div class="row">
<div class="col-lg-2 text-center hidden-md hidden-sm hidden-xs noprint">
<div class="sky-ad"></div>
</div>
<!-- content -->
<div class="col-xs-12 col-lg-8 text-center">
<div class="div-share noprint">
<div class="fb-like" style="float:left;" data-href="https://www.azlyrics.com/lyrics/calvinharris/nuhreadynuhready.html" data-layout="button_count" data-action="like" data-show-faces="false" data-share="false"></div>
<!-- AddThis Button BEGIN -->
<script type="text/javascript" src="https://s7.addthis.com/js/300/addthis_widget.js#username=azlyrics"></script>
<div class="addthis_toolbox addthis_default_style" style="float:right;">
<a class="btn btn-xs btn-share addthis_button_email">
<span class="playblk"><img src="//www.azlyrics.com/images/email.svg" width="56" height="18" class="playblk" alt="Email"></span>
</a>
<a class="btn btn-xs btn-share addthis_button_print" style="margin-right: 0px !important;">
<span class="playblk"><img src="//www.azlyrics.com/images/print.svg" width="56" height="18" class="playblk" alt="Print"></span>
</a>
</div>
</div>
<!-- AddThis Button END -->
<div class="div-share"><h1>"Nuh Ready Nuh Ready" lyrics</h1></div>
<div class="lyricsh">
<h2><b>Calvin Harris Lyrics</b></h2>
</div>
<div class="ringtone">
<span id="cf_text_top"></span>
</div>
<b>"Nuh Ready Nuh Ready"</b><br>
<span class="feat">(feat. PARTYNEXTDOOR)</span><br>
<br>
<div>
<!-- Usage of azlyrics.com content by any third-party lyrics provider is prohibited by our licensing agreement. Sorry about that. -->
Mi and di mandem<br>
We haffi run from half of di gyal dem<br>
So sweet, so sweet<br>
Don't want mi children and ting'<br>
Mi nuh ready fi all dem tings<br>
So sweet, you're so sweet, yeah<br>
Yeah, mi nuh ready fi all dem things yet<br>
So sweet, so sweet, yeah<br>
Yeah, I'm not ready fi all dem tings yet<br>
I'm not ready fi all dem tings yet<br>
<br>
She call me kid, kid, kid<br>
My mama kiss her kid<br>
She say mi tooth-tooth sweet<br>
She say mi tooth-tooth sweet<br>
Don't make me feel like I love you<br>
Just 'cause I thought you was special<br>
Won't make me feel like I love you<br>
Baby, girl, I won't settle<br>
I had dreams of fuckin' the baddest bitch<br>
Last night I awoke up and I fucked the baddest bitch<br>
I thought I would be ready when I seen her<br>
When I was in the disco<br>
I gotta keep it honest<br>
Keep it real with you<br>
<br>
Mi and di mandem<br>
We haffi run from half of di gyal dem<br>
So sweet, so sweet<br>
Don't want mi children and tings<br>
Mi nuh ready fi all dem tings<br>
So sweet, you're so sweet<br>
Mi nuh ready fi all dem tings yet<br>
So sweet, so sweet<br>
Mi and di mandem<br>
We haffi run from half of di gyal dem<br>
So sweet, you're so sweet<br>
Don't want mi children and tings<br>
Mi nuh ready fi all dem tings<br>
So sweet, you're so sweet<br>
Mi nuh ready fi all dem tings<br>
So sweet, so sweet<br>
<br>
I strapped up 'cause they mapped up<br>
'Cause I need to know where you are<br>
Can't keep following these signs<br>
'Cause you're lookin' for a sign, and I can't give you one<br>
Start to feel like it's mad love<br>
That's givin' your attraction, to me<br>
Yeah, I just want you, nobody else, baby<br>
I don't wanna get too far<br>
It's just you that I want<br>
<br>
When it's mi and di mandem<br>
We haffi run from half of di gyal dem<br>
So sweet, so sweet<br>
Don't want mi children and tings<br>
Mi nuh ready fi all dem tings<br>
So sweet, you're so sweet<br>
Mi nuh ready fi all dem tings yet<br>
So sweet, so sweet<br>
Mi and di mandem<br>
We haffi run from half of di gyal dem<br>
So sweet, so sweet<br>
Don't want mi children and tings<br>
Mi nuh ready fi all dem tings<br>
So sweet, you're so sweet<br>
Mi nuh ready fi all dem tings
</div>
<br><br>
<!-- MxM banner -->
<div class="noprint">
<script>
if ( /Android|webOS|iPhone|iPod|iPad|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) )
{
document.write('<div style="margin-left: auto; margin-right: auto;">'+
'<iframe scrolling="no" style="border: 0px none; overflow:hidden;" src="//adv.mxmcdn.net/br/t1.0/m_js/e_0/sn_0/l_17494554/su_0/tr_3vUCAOZlq_zEKGGqiwqgUipktnY4AJ8vdMlDERwd-IQW1fCzlbIik50-scymuRv_pi3wUAIxUI2AiwodRggYSWyWKe5520YE8tdDBkiBtPeafB1eU4jsrx-cHUKKrQnbpH1kEJ6cxCXNRK21S-URGe9hKl3IVQsjUfAjAGzo670kV-_NZoBHp8gEZ5eOQESUhj_qd_IMSEvXm2euf-p8Ih6vduevXpBlMcIEAKI3kCxKguw10zJEFpaF8yFsaYWxPJ04Xubjxi6nlSUBsg_Tr8m9oMC4dgrbSjSYIrAWyJz1IIVbLSkQUGxPFTsbNsL_-bnudnLQaUE_eaP3nAsOaQdHURbAr7wki_hHoAjXgZpE4VF7MLao4sJEJ4jJaHu9IhQphsYTZfU6HCHDQhcz3lF_zned3kiL-MhHIP8j0K_ktF3poJHjI5u9L-cJHNywsz-sadxqsZMdqBf1jMraRS68zUYcTR9L15oyvk54l_erv80gD-ns/" width="290px" height="50px"></iframe>'+
'</div>');
}
</script>
<br><br>
</div>
<form id="addsong" style="visible:hidden; margin:0;" action="../../add.php" method="post">
<input type="hidden" name="what" value="add_song">
<input type="hidden" name="artist" value="Calvin Harris">
</form>
<form action="../../add.php" method="post" id="corlyr">
<input type="hidden" name="what" value="correct_lyrics">
<input type="hidden" name="song_id" value="613870">
</form>
<div class="smt noprint">
<a class="btn btn-share" href="#" onclick="submitCorrections()"><span class="glyphicon glyphicon-pencil"></span> Submit Corrections</a>
</div>
<div class="smt"></div>
<div class="noprint" style="padding: 15px 0">
<span id="cf_text_bottom"></span>
</div>
<!-- credits -->
<div class="smt"></div>
<!-- song facts -->
<!-- artist link -->
<ol class="breadcrumb noprint" itemscope itemtype="https://schema.org/BreadcrumbList">
<li itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem"><a itemprop="item" href="//www.azlyrics.com"><span itemprop="name">AZLyrics</span></a></li>
<li itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem"><a itemprop="item" href="//www.azlyrics.com/c.html"><span itemprop="name">C</span></a></li>
<li itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem"><a itemprop="item" href="//www.azlyrics.com/c/calvinharris.html"><span itemprop="name">Calvin Harris Lyrics</span></a></li>
</ol>
<!-- album songlists -->
<!-- album songlists end -->
<form class="search noprint" method="get" action="//search.azlyrics.com/search.php" role="search">
<div style="margin-bottom:15px" class="input-group">
<input type="text" class="form-control" placeholder="" name="q">
<span class="input-group-btn">
<button class="btn btn-primary" type="submit"><span class="glyphicon glyphicon-search"></span> Search</button>
</span>
</div>
</form>
<div class="noprint visible-xs-block" style="margin-top:5px;margin-bottom:5px">
<span id="cf_rect_bottom"></span>
</div>
</div> <!-- content -->
<div class="col-lg-2 text-center hidden-md hidden-sm hidden-xs noprint">
<div class="sky-ad"></div>
</div>
</div>
</div> <!-- container main-page -->
<!-- nav bottom -->
<nav class="navbar navbar-default navbar-bottom">
<div class="container text-center">
<ul class="nav navbar-nav navbar-center">
<li>Submit Lyrics</li>
<li>Soundtracks</li>
<li>Facebook</li>
<li>Contact Us</li>
</ul>
</div>
</nav>
<!-- bot ban -->
<div class="lboard-wrap noprint">
<div class="container">
<div class="row">
<div class="col-xs-12 top-ad text-center">
<span id="cf_banner_bottom"></span>
</div>
</div>
</div>
</div>
<!-- footer -->
<nav class="navbar navbar-footer noprint">
<div class="container text-center">
<ul class="nav navbar-nav navbar-center">
<li>Advertise Here</li>
<li>Privacy Policy</li>
<li>DMCA Policy</li>
</ul>
</div>
</nav>
<div class="footer-wrap">
<div class="container">
<div class="noprint"><span style="font-weight:bold;line-height:54px;vertical-align:top;">Powered by </span><img src="//www.azlyrics.com/images/mxm.png" width="184" height="54" alt="MusixMatch"></div>
<small>
Calvin Harris lyrics are property and copyright of their owners. "Nuh Ready Nuh Ready" lyrics provided for educational purposes and personal use only.<br>
<script type="text/javascript">
curdate=new Date();
document.write("<strong>Copyright © 2000-"+curdate.getFullYear()+" AZLyrics.com<\/strong>");
</script>
</small>
</div>
</div>
<script>
cf_page_artist = ArtistName;
cf_page_song = SongName;
cf_page_genre = "pop";
</script>
<script src="//cdn.clickfuse.com/publishers/azlyrics/single.min.js"></script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-4309237-1']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<div id="CssFailCheck" class="hidden" style="height:1px;"></div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="//www.azlyrics.com/local/jquery.min.js"><\/script>')</script>
<script>
$(function () {
if ($('#CssFailCheck').is(':visible') === true) {
$('<link rel="stylesheet" type="text/css" href="//www.azlyrics.com/bs/css/bootstrap.min.css"><link rel="stylesheet" href="//www.azlyrics.com/bsaz.css">').appendTo('head');
}
});
</script>
<script src="//www.azlyrics.com/collapse.js"></script>
<script type="text/javascript" src="https://tracking.musixmatch.com/t1.0/m_js/e_0/sn_0/l_17494554/su_0/tr_3vUCAOZlq_zEKGGqiwqgUipktnY4AJ8vdMlDERwd-IQW1fCzlbIik50-scymuRv_pi3wUAIxUI2AiwodRggYSWyWKe5520YE8tdDBkiBtPeafB1eU4jsrx-cHUKKrQnbpH1kEJ6cxCXNRK21S-URGe9hKl3IVQsjUfAjAGzo670kV-_NZoBHp8gEZ5eOQESUhj_qd_IMSEvXm2euf-p8Ih6vduevXpBlMcIEAKI3kCxKguw10zJEFpaF8yFsaYWxPJ04Xubjxi6nlSUBsg_Tr8m9oMC4dgrbSjSYIrAWyJz1IIVbLSkQUGxPFTsbNsL_-bnudnLQaUE_eaP3nAsOaQdHURbAr7wki_hHoAjXgZpE4VF7MLao4sJEJ4jJaHu9IhQphsYTZfU6HCHDQhcz3lF_zned3kiL-MhHIP8j0K_ktF3poJHjI5u9L-cJHNywsz-sadxqsZMdqBf1jMraRS68zUYcTR9L15oyvk54l_erv80gD-ns/"></script>
</body>
</html>
What changes should I do to achieve the above? Thanks
The following code should get you the lyrics formatted how you want:
// Get the lyrics div element
Element lyricsDiv = document.select("div.main-page > div.row > div.col-xs-12").select("div").get(7);
// Get the html of the element and replace <br> and comments
String lyrics = lyricsDiv.html().replaceAll("<br>", "").replaceAll("<!--(.*?)-->", "");
Try this
Elements main = doc.select("div[class=container main-page]");
Elements row = main.select("div[class=row]");
Elements col = row.select("div[class=col-xs-12 col-lg-8 text-center]");
songMetaDataTextView.setText(Html.fromHtml(col.select("div").get(7).toString());
You have nested tags
<div class="container main-page">
<div class="row">
<div class="col-lg-2 text-center hidden-md hidden-sm hidden-xs noprint">
<div class="sky-ad"></div>
</div>
<!-- content -->
<div class="col-xs-12 col-lg-8 text-center">
<div class="div-share noprint">
<div class="fb-like" style="float:left;" data-href="https://www.azlyrics.com/lyrics/calvinharris/nuhreadynuhready.html" data-layout="button_count" data-action="like" data-show-faces="false" data-share="false"></div>
<!-- AddThis Button BEGIN -->
<script type="text/javascript" src="https://s7.addthis.com/js/300/addthis_widget.js#username=azlyrics"></script>
<div class="addthis_toolbox addthis_default_style" style="float:right;">
<a class="btn btn-xs btn-share addthis_button_email">
<span class="playblk"><img src="//www.azlyrics.com/images/email.svg" width="56" height="18" class="playblk" alt="Email"></span>
</a>
<a class="btn btn-xs btn-share addthis_button_print" style="margin-right: 0px !important;">
<span class="playblk"><img src="//www.azlyrics.com/images/print.svg" width="56" height="18" class="playblk" alt="Print"></span>
</a>
</div>
</div>
<!-- AddThis Button END -->
<div class="div-share"><h1>"Nuh Ready Nuh Ready" lyrics</h1></div>
<div class="lyricsh">
<h2><b>Calvin Harris Lyrics</b></h2>
</div>
<div class="ringtone">
<span id="cf_text_top"></span>
</div>
<b>"Nuh Ready Nuh Ready"</b><br>
<span class="feat">(feat. PARTYNEXTDOOR)</span><br>
<br>
<div>
<!- your lyrics her -->
So first you get container main-page then row and then col-xs-12 col-lg-8 text-center and then finally get the text using index 7
Related
I'm getting black "bars" on I open modal's on android's chrome, as show on my attachments, well, this is my code, and I'm using bootstrap 4.1. Anyone can help me?.
<div class="modal fade" id="modalCombos" tabindex="-100" role="dialog" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Combos</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
#foreach (var item in combosList)
{
<div class="row" style="margin-bottom:5px">
<div class="btn btn-danger col-12" onclick="addItem('#item.Nome', '#item.Valor.ToString("F")')">
#item.Nome - R$ #item.Valor.ToString("F")
</div>
</div>
}
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Fechar</button>
</div>
</div>
</div>
</div>
Change .fade.in opacity property on bootstrap.min.css from 1 to 0.99:
.fade.in{opacity:0.99}
Also try this on bootstrap.min.css:
.fade.in{opacity:1;-webkit-backface-visibility: hidden;}
I am using Bootstrap v3.3.2 with JQuery 2.13 and JQueryMobile 1.4.5
The bootstrap carousel works smoothly on iPAD & Windows 8 Tablets but it almost does not work on Android tablets (v4.4.2)
On Android, the swipe event does not fire easily. You have to swipe (left or right) many times and then only one time it fires. So the swipe has issues on Android. While on other two platforms its like breeze.
Here is my code piece:
HTML
<div id="Carousel" class="carousel slide" data-interval="false">
<ol class="carousel-indicators">
<li data-target="#Carousel" data-slide-to="0" ></li>
<li data-target="#Carousel" data-slide-to="1"></li>
<li data-target="#Carousel" data-slide-to="2"></li>
</ol>
<div class="carousel-inner">
<div class="item active">
<div class="row">
<div class="col-sm-4">
<div>DATA 1</div>
</div>
<div class="col-sm-4">
<div>DATA 2</div>
</div>
<div class="col-sm-4">
<div>DATA 3</div>
</div>
</div>
</div>
<div class="item">
<div class="row">
<div class="col-sm-4">
<div>DATA 4</div>
</div>
<div class="col-sm-4">
<div>DATA 5</div>
</div>
<div class="col-sm-4">
<div>DATA 6</div>
</div>
</div>
</div>
<div class="item">
<div class="row">
<div class="col-sm-4">
<div>DATA 7</div>
</div>
<div class="col-sm-4">
<div>DATA 8</div>
</div>
<div class="col-sm-4">
<div>DATA 9</div>
</div>
</div>
</div>
</div>
<a data-slide="prev" href="#Carousel" class="left carousel-control leftArrowIcon"></a>
<a data-slide="next" href="#Carousel" class="right carousel-control rightArrowIcon"></a>
</div>
JS
$("#afterLoginPage").on("pageshow", function( event ) {
$('#Carousel').each(function(){
var $myCarousel = $(this);
$myCarousel.swipeleft(function() {
$(this).carousel('next');
console.log("Carousel - next" );
});
$myCarousel.swiperight(function() {
$(this).carousel('prev');
console.log("Carousel - prev" );
});
});
});
Also tried in this way but no benefit:
$("#afterLoginPage").on("pageshow", function( event ) {
$("#Carousel").on("swiperight", function() {
console.log("Carousel - prev" );
$(this).parent().carousel('prev');
// $(this).carousel('prev'); // did not work as well
});
$("#Carousel").on("swipeleft", function() {
console.log("Carousel - next" );
$(this).parent().carousel('next');
// $(this).carousel('next'); // did not work as well
});
});
I want to make a mobile application on android and I use adobe dreamwever cs6, php and mysql(bundle on XAMPP). I have a problem on my login process.
Can you tell me where is the errors of my code? because my login form only stuck on loader when i press the login button. Please help me.
This is my index.html code on dreamweaver...
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Login Form</title>
<link href="jquery-mobile/jquery.mobile.theme-1.4.4.min.css" rel="stylesheet" type="text/css"/>
<link href="jquery-mobile/jquery.mobile.structure-1.4.4.min.css" rel="stylesheet" type="text/css"/>
<script src="jquery-mobile/jquery-1.11.1.min.js" type="text/javascript"></script>
<script src="jquery-mobile/jquery.mobile-1.4.4.min.js" type="text/javascript"></script>
<script>
$(document).ready(function() {
$("#btnLogin").click(function() {
username=$("#username").val();
password=$("#password").val();
$.ajax({
type:'POST',
url:"login.php",
data:"username="+username+"&password="+password,
success: function(data){
if(data=='true'){
window.location ( "hhome.html");
} else {
$("#add_err").html("<img src='images/icons-png/alert-black.png' />Wrong Username or Password!!");
}
},beforeSend: function()
{
$("#add_err").html("<img src='images/ajax-loader.gif' />")
}
});
return false;
});
});
</script>
</head>
<body>
<div id="page" data-role="page" >
<div data-role="header" data-theme="b" >
<h1></h1>
</div>
<div align="center" data-role="content" data-theme="a" >
<img src="sma-baktiidhata.jpg" width="214" height="178"><br>
<p>Go to the login page</p><br><br>
Login
</div>
<div data-role="footer" data-theme="b" >
<h4></h4>
</div>
</div>
<div data-role="page" id="page2">
<div data-role="header" data-theme="b">
<h1>Login User</h1>
</div>
<div data-role="content">
<form action="login.php" method="post" id="add_err">
<div data-role="fieldcontain">
<input type="text" name="username" id="username" value="" placeholder="Username" />
<input name="password" type="password" id="password" placeholder="Password" value="" maxlength="10" />
</div>
<input name="Submit" type="submit" id="btnLogin" value="Login" />
</form>
</div>
<div data-role="footer" data-theme="b">
<h5>© 2014 </h5>
</div>
</div>
</body>
</html>
Hi all I have the following code
<script type="text/javascript" src="/js/jquery-2.0.0.min.js"></script>
<script src="/js/jquery.mobile-1.3.1.js" type="text/javascript"></script>
but for some reason in Chrome and on any android it just crashes the page and at the bottom I just get a "Loading" message
does anyone know why?
thanks
Solution
Don't use jQuery 2.0 with jQuery mobile 1.3.1
jQuery Mobile is locked to a certain jQuery version range. Use only jQuery 1.7 up to 1.9.X
And you have several errors in your live example.
CSS should be initialized before js files and your HTML tag was missing. Also DIV containing the page must have data-role="page" attribute.
EDIT :
Your final code should look like this:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link rel="stylesheet" type="text/css" href="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.css">
<script type='text/javascript' src='http://code.jquery.com/jquery-1.9.1.min.js'></script>
<script type="text/javascript" src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script>
<title>Packer Forbes Communications</title>
</head>
<body>
<div id="pageHead" data-role="page">
<div id="logo"><img src="images/packerForbesLogo.jpg" width="226" height="106" alt="Packer Forbes" /></div>
<div id="socMedia"><img src="/images/socIconPM.jpg" width="35" height="40" alt="PMLive" /><img src="/images/socIconIN.jpg" width="35" height="40" alt="LinkedIn" /><img src="/images/socIconTW.jpg" width="35" height="40" alt="Twitter" /><img src="/images/socIconYT.jpg" width="35" height="40" alt="YouTube" /></div>
<div id="mainNav" role="navigation">
Show navigation
Hide navigation
<ul id="nav" class="clearfix">
<li>Home</li>
<li>What We Do
<ul>
<li>Market Access</li>
<li class="navIndent">Case Studies</li>
<li>Public Relations</li>
<li class="navIndent">Case Studies</li>
<li>Medical Education</li>
<li class="navIndent">Case Studies</li>
<li>Digital</li>
<li class="navIndent">Case Studies</li>
</ul>
</li>
<li>About Us
<ul>
<li>Awards</li>
<li>The Team</li>
<li>Life at Packer Forbes</li>
<li>Our Values</li>
</ul>
</li>
<li>Clients</li>
<li>News</li>
<li>Careers
<ul>
<li>Training</li>
<li>Internships</li>
<li>Benefits</li>
<li>Current Vacancies</li>
</ul>
</li>
<li>Contact</li>
<li>Download Centre</li>
</ul>
</div>
<div id="mainBanner"><img src="images/twentyBanner.gif" alt="We Are Twenty!" width="400" height="80" border="0" class="homeBanner" /></div>
</div>
<div id="mainBody">
<div id="contentWrapper">
<p class="brandStrip"> </p>
<div id="mainColumn">
<!--<h1>Who We Are</h1>-->
<h2>What We Do</h2>
<div id="marketAccess"> <img src="images/marketAccess.jpg" width="160" height="160" alt="Market Access" />
<h3>Market Access</h3>
</div>
<div id="communications"> <img src="images/communications.jpg" width="160" height="160" alt="Communications" />
<h3>Public Relations</h3>
</div>
<div id="medicalEducation"> <img src="images/medicalEducation.jpg" width="160" height="160" alt="Medical Education" />
<h3>Medical Education</h3>
</div>
<div id="digital"><img src="images/digital.jpg" width="160" height="160" alt="Digital" />
<h3>Digital</h3>
</div>
<p class="firstParaHome">Packer Forbes is an award-winning independent healthcare communications consultancy, specialising in medical communications. Our integrated approach ensures that our clients benefit from a compelling fusion of bespoke market access, public relations, medical education and digital communications approaches, all built on insight developed from years of experience.</p>
<p class="dividerLong"><span class="dividerLongMore">Find Out More»</span></p>
<p class="mobileindexorgslogos">
<img src="images/logoHCA.jpg" width="102" height="109" alt="HCA" />
<img src="images/logoEMIG.jpg" width="102" height="109" alt="EMIG" />
<img src="images/logoIIP.jpg" width="121" height="109" alt="IIP" />
<img src="images/abpi_new.jpg" width="102" height="109" alt="IIP" />
<div class="mobileclear"></div>
</p>
</div>
<div id="sideColumn"></div>
<p class="brandStrip"> </p>
</div>
</div>
<div id="pageFoot">
<ul>
<li>1.09 Harbour Yard, Chelsea Harbour, London, SW10 0XD</li>
<li>t: +44 (0)20 7036 8550</li>
<li>f: +44 (0)20 7036 8569</li>
<li>e: healthmail#packerforbes.com</li>
<li>cookie policy</li>
</ul>
<p>Registered office: Packer Forbes Communications Ltd, 1.09 Harbour Yard, Chelsea Harbour, SW10 0XD Registered number: 3753460 </p>
</div>
</body>
</html>
If you are using JQM 1.3.1, you can use this 2 script files.
jQuery JavaScript Library v1.9.1 http://view.jquerymobile.com/1.3.1/dist/demos/js/jquery.js
jQuery Mobile 1.3.1 http://view.jquerymobile.com/1.3.1/dist/demos/js/jquery.mobile.min.js
Loading message error
If you want to hide this message, try to use this as soon as on load.
$(document).ready(function() {
$('.ui-loader').hide();
});
I'm having major issues testing my jquery mobile app on Chrome for Android tablets. It works everywhere else except for chrome on android tab.
When I click any button on the page that navigates away from the page, it will refresh the same page I'm in and put it in a popup box. But, if you close the popup and hit any button again it works.
I have a screen shot here...
http://i.imgur.com/NEUIRfa.png
Here is my code:
<%#page language="abap" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Leave Request Approval</title>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.1/jquery.mobile- 1.3.1.min.css" />
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script>
<style type="text/css">
.ui-field-contain {
border-bottom-width : 0px !important;
}
</style>
</head>
<!-- Details Page -->
<div data-role="page" id="leave_details" data-theme = "b" >
<body>
<div id="Head" data-theme = "b" data-role="header" data-position="fixed">
<a href="" data-role="button" data-theme = "b" class="ui-btn-left">
Back
</a>
<% DATA: lv_head TYPE string.
CONCATENATE 'Leave Request' '-' INTO lv_head SEPARATED BY space.
CONCATENATE lv_head model->ms_details-type_txt INTO lv_head SEPARATED BY space.
CONCATENATE lv_head '-' model->ms_details-emp_name INTO lv_head SEPARATED BY space. %>
<h3>
<%= lv_head. %>
</h3>
</div> <!--End Header -->
<div data-role="content" data-scroll="true">
<% IF model->mv_error IS NOT INITIAL AND model->ms_details IS INITIAL. %>
<span style="color: #FF0000;"> <b> <%= model->mv_error. %> </b> </span>
<% RETURN. %>
<% ELSE. %>
<% IF model->mv_success IS NOT INITIAL OR
model->mv_error IS NOT INITIAL. %>
<div> <!--Begin top portion of page -->
<% IF model->mv_success IS NOT INITIAL. %>
<span style="color: #008000;"> <b> <%= model->mv_success. %> </b> </span>
<% ENDIF. %>
<% IF model->mv_error IS NOT INITIAL. %>
<span style="color: #FF0000;"> <b> <%= model->mv_error. %> </b> </span>
<% CLEAR: model->mv_error. %>
<% IF model->mv_locked = abap_false. %>
<% RETURN. %>
<% ENDIF. %>
<% ENDIF. %>
<%-- <p style="text-align: center;" data-mce-style="text-align: center;">
<b>
<%= model->ms_details-emp_name. %>
</b>
</p>--%>
</div> <!--End top portion of page -->
<% ENDIF. %>
<!--Begin Basic Listbox -->
<div data-role="collapsible" data-collapsed="true" data-theme = "b" data-content-theme = "b">
<h3>
Basic
</h3>
<div data-role="fieldcontain">
<label for="sup"><b>Supervisor:</b></label>
<input type="text" readonly name="sup" id="sup" value="<%=model->ms_details-sup_name %>" />
</div>
<div data-role="fieldcontain">
<label for="crby"><b>Created By:</b></label>
<input type="text" readonly name="crby" id="crby" value="<%=model->ms_details-cr_by %>" />
</div>
<div data-role="fieldcontain">
<label for="crdt"><b>Created Date:</b></label>
<input type="text" readonly name="crdt" id="crdt" value="<%=model->ms_details-req_date %>" />
</div>
<div data-role="fieldcontain">
<label for="crtm"><b>Created Time:</b></label>
<input type="text" readonly name="crtm" id="crtm" value="<%=model->ms_details-req_time %>" />
</div>
</div> <!--End Basic Listbox -->
<!--Begin Details Listbox -->
<div data-role="collapsible" data-collapsed="false" data-theme = "b" data-content-theme = "b">
<h3>
Details
</h3>
<div data-role="fieldcontain">
<label for="hours"><b>Absence Hours:</b></label>
<input type="text" readonly name="hours" id="hours" value="<%=model->ms_details-hours %>" />
</div>
<div data-role="fieldcontain">
<label for="type"><b>Absence Type:</b></label>
<input type="text" readonly name="type" id="type" value="<%=model->ms_details-awart %>" />
</div>
<div data-role="fieldcontain">
<label for="begdt"><b>Leave Begin Date:</b></label>
<input type="text" readonly name="begdt" id="begdt" value="<%=model->ms_details-date_fr %>" />
</div>
<div data-role="fieldcontain">
<label for="enddt"><b>Leave End Date:</b></label>
<input type="text" readonly name="enddt" id="enddt" value="<%=model->ms_details-date_to %>" />
</div>
<div data-role="fieldcontain">
<label for="begmeal"><b>Begin Meal Time:</b></label>
<input type="text" readonly name="begmeal" id="begmeal" value="<%=model->ms_details-beg_meal %>" />
</div>
<div data-role="fieldcontain">
<label for="endmeal"><b>End Meal Time:</b></label>
<input type="text" readonly name="endmeal" id="endmeal" value="<%=model->ms_details- end_meal %>" />
</div>
<!--Begin Other Buttons -->
<div class="ui-grid-a">
<div class="ui-block-a"><font size="2">History</font></div>
<div class="ui-block-b"><font size="2">Quotas</font></div>
</div>
<!--End Other Buttons -->
</div> <!--End Details Listbox -->
<!--Begin Notes Listbox -->
<div data-role="collapsible" data-collapsed="true" data-theme = "b" data-content-theme ="b">
<h3>
Notes
</h3>
<div data-role="fieldcontain">
<label for="medtime"><b>Med Appt Time:</b></label>
<input type="text" readonly name="medtime" id="medtime" value="<%=model->ms_details-med_time %>" />
</div>
<div data-role="fieldcontain">
<label for="fam"><b>Family Rel:</b></label>
<input type="text" readonly name="fam" id="fam" value="<%=model->ms_details-relation %>" />
</div>
<div data-role="fieldcontain">
<label for="flu"><b>Influenza:</b></label>
<input type="text" readonly name="flu" id="flu" value="<%=model->ms_details-flu %>" />
</div>
<% DATA: lv_cert TYPE char3.
IF model->ms_details-medcert = abap_true.
lv_cert = 'Yes'.
ELSE.
lv_cert = 'No'.
ENDIF.
%>
<div data-role="fieldcontain">
<label for="cert"><b>Medical Cert:</b></label>
<input type="text" readonly name="cert" id="cert" value="<%=lv_cert %>" />
</div>
<div data-role="fieldcontain">
<label for="Remarks"><b>Remarks:</b></label>
<textarea readonly name="Remarks" id="Remarks" ><%=model->ms_details-remarks %></textarea>
</div>
</div> <!--End Notes Listbox -->
<% IF model->mv_disp NE 'O' AND model->mv_success IS INITIAL. %>
<!--Begin Footer-->
<div id="Footer" data-theme = "b" data-role="footer" data-position="fixed">
<h3></h3>
<a href="" data-rel="dialog" data-role="button" data-inline="true" data-transition="pop" data-theme = "b" class="ui-btn-left">
<% IF model->mv_done_only = abap_false. %>
Approve
<% ELSE. %>
Done
<% ENDIF. %>
</a>
<% IF model->mv_done_only = abap_false. %>
<a href="" data-rel="dialog" data-role="button" data-inline="true" data-transition="pop" data-theme = "b" class="ui-btn-right">
Reject
</a>
<% ENDIF. %>
</div>
<!--End Footer-->
<% ENDIF. %>
<% ENDIF. %>
</div> <!--End Content -->
</body>
</div> <!--End Details Page -->
</html>