<link rel="stylesheet" href="{$base_url}resources/themes/{$set_theme}/css/jquery-ui.css" />
<script type="text/javascript" src="{$base_url}resources/javascript/jquery/jquery-1.8.3.js"></script>
<script type="text/javascript" src="{$base_url}resources/javascript/jquery/jquery-ui.js"></script>
<script type="text/javascript">jQuery.noConflict();</script>
<form action="{$base_url}{$fil_index_register}" id="register" method="post" autocomplete="off">
date of brith:<input type="text" maxlength="50" name="cal" value="" class="" id="ds" >
<input type="button" name="button" onclick="javascript:$('register').submit();" value="ACCOUNT_040" class="button" />
</form>
<script type="text/javascript">
{literal}
$(function(){
$( "#ds" ).datepicker({ dateFormat: "dd-mm-yy" });
});
{/literal}
</script>
problem:-when i include js script script submit button is not working but js of calender is working and when remove js script submit button starts works.please help me.i am implementing this on pixaria software
"$" create the problem so i avoid "$" i used
onclick="javascript:document.forms['register'].submit();
You need to call:
$('#register').submit();
You have forgot about # (select for element's ID)
so, you mean that the submit button is not working??
well, here's the solution:
change the:
$('register')
to:
$('#register')
'#' symbol is identifier for id
'.' symbol is for class
and no symbol is for HTML tags
Hope this works
Related
I want to get a paragraph data from HTML file into the php code.
In my html file I have the following line:
<p style="display: inline;" id="symptoms" name = "symptoms"</p>
In the html file document.getElementById('symptoms').value gathers all the necessary data I want to use in the php code. Obviously, $symptoms = $_POST['symptoms']; doesn't get anything. How can I get it work?
We can actually get the value inside the symptoms as shown here for Jquery. To use this value as php POST value. We can improvise this by next set of code.
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
</head>
<p style="display: inline;" id="symptoms" name = "symptoms"> HEllo Hari</p>
<script>
$(document).ready(function(){
alert($("#symptoms").html());
});
</script>
Maybe we modify following code as required to achieve what you expect
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
</head>
<p style="display: inline;" id="symptoms" name = "symptoms"> HEllo Hari</p>
<form method="POST" action="/*toPHPfilePath*/" id="target" >
<input type="hidden" id="hidden_symptoms" name="symptoms">
</form>
<script>
$(document).ready(function(){
$("#hidden_symptoms").val($("#symptoms").html());
$( "#target" ).submit(function( event ) {
alert( "Handler for .submit() called." );
event.preventDefault();
});
});
</script>
Folks,
I am new to js and this I am having trouble capturing and taking a screenshot of a remote website. Can someone point me in the right direction
I keep getting this error:
Uncaught TypeError: Object [object Object] has no method 'html2canvas' index.php:4201
capture index.php:4201
onclick
My code is index.php
<html>
<head>
<title>Hawk-Eye: Have a look at what others are upto</title>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="http://localhost/Hawk-eye/html2canvas.js"></script>
<script type="text/javascript" src="http://localhost/Hawk- eye/jquery.plugin.html2canvas.js"></script>
</head>
<body>
<div id="target">
<?php
$homepage= file_get_contents('http://www.yahoo.com');
echo $homepage;
?>
</div>
<form method="POST" enctype="multipart/form-data" action="save.php" id="myForm">
<input type="hidden" name="img_val" id="img_val" value="" />
</form>
<script type="text/javascript">
function capture() {
$('#target').html2canvas({
onrendered: function (canvas) {
//Set hidden field's value to image data (base-64 string)
$('#img_val').val(canvas.toDataURL("image/png"));
//Submit the form manually
document.getElementById("myForm").submit();
}
});
}
</script>
<input type="submit" value="Take Screenshot" onclick="capture();" />
</body>
</html>
Download html4canvas and import it as
<script type="text/javascript" src="html2canvas.js?rev032"></script>
My jQuery codes doesn't work, and I can't find why. The code seems to be ok.
My html code
<html>
<head>
<title>Learning Jquery</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<input type="file">
<br />
<input type="submit" disabled="disabled">
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="myjquery.js"></script>
</body>
</html>
The javascript code
$(document).ready(function (){
$('input[type=file]').change(function(){
$(this).next().removeAttr('disabled');
});
});
If you want to enable your submit button, then try this javascript code:
$(document).ready(function (){
$('input[type=file]').change(function(){
$(this).closest('form').find('[type=submit]').prop('disabled', false);
});
});
.next() selects the immediately following sibling of the element you chose, which in your case would be a break (<br />). Try instead:
$(this).siblings('input[type=submit]').removeAttr('disabled');
jsFiddle example
I am new to using jquery and i have written the following code and it does not work and i am not able to figure out what the mistake is ..syntax might also be wrong.
It has 2 submit buttons while using button1 it should get info from the DB and display on the same page.i.e., get the title from the DB and display on the same page.
While second submit button is used to submit title into the DB and update it(written in script_2.php).
<form id="myForm" method="post">
id: <input type="text" name="search"/>
<input type="button" id="button1" value="Submit to script 1" />
<input type="button" id="button2" value="Submit to script 2" />
title:<input type="text" name="title"/>
</form>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#button1").click(function(){
$.post('script_1.php', { name: form.name.value },
function(output) {
$('#age').html(output).show();
}) ;
}) ;
$("#button2").click(function(){
$('form#myForm').attr({action: "script_2.php"});
$('form#myForm').submit();
});
});
</script>
</head>
Help appreciated.
You are missing the }); to close the $("#button1").click function:
<script type="text/javascript">
$(document).ready(function(){
$("#button1").click(function(){
$.post('script_1.php', { name: form.name.value },function(output) {$('#age').html(output).show();});
});
$("#button2").click(function(){
$('form#myForm').attr({action: "script_2.php"});
$('form#myForm').submit();
});
});
</script>
You have too many closing
<script type="text/javascript" src="jquery.js"></script></script>
to
<script type="text/javascript" src="jquery.js"></script>
jQuerys attr() expects strings, not an object, like:
$('form#myForm').attr("action", "script_2.php");
You form is before your <head> tag. It should be after your </head> and in a <body> tag.
You are putting the results of your ajax call in an element with id age, but I don't see any element with that id on your page.
That's all for errors (that I see as of now), but you can also speed up your selecter here $('form#myForm') by changing it to $('#myForm') since id's are unique, and I doubt you have any element with the id myForm which isn't a form.
hi im trying to integrate a jquery datepicker to my codeigniter project.. the problem is that i cant get it to work .. my source code came from http://view.jquery.com/tags/ui/latest/demos/functional/#ui.datepicker
ok heres my code:
view:
<srcipt>
$("#formatted").datepicker({
dateFormat: $.datepicker.ISO_8601,
showOn: "both",
buttonImage: "templates/images/calendar.gif",
buttonImageOnly: true
});
</script>
<form action="add" method="post" class="form label-inline uniform" />
<input type="text" size="30" value="" id="formatted"/>
<input type="submit" class="btn btn-grey" value="Add User"/>
</form>
<script src="/assets/js/jquery/jquery-1.5.2.min.js"></script>
EDIT
i already added all the js sources but its still not working
<script src="/assets/js/jquery/jquery-1.5.2.min.js"></script>
<script src="/assets/js/jquery/jquery-ui-1.8.12.custom.min.js"></script>
<script src="/assets/js/misc/excanvas.min.js"></script>
<script src="/assets/js/jquery/facebox.js"></script>
<script src="/assets/js/jquery/jquery.visualize.js"></script>
<script src="/assets/js/jquery/jquery.dataTables.min.js"></script>
<script src="/assets/js/jquery/jquery.tablesorter.min.js"></script>
<script src="/assets/js/jquery/jquery.uniform.min.js"></script>
<script src="/assets/js/jquery/jquery.placeholder.min.js"></script>
<script src="/assets/js/widgets.js"></script>
<script src="/assets/js/dashboard.js"></script>
EDIT
created a sample view page for datepicker.. still not working even the link for the image is not working.
<html>
<head>
<script src="/assets/js/jquery/jquery-1.5.2.min.js"></script>
<script src="/assets/js/jquery/jquery-ui-1.8.12.custom.min.js"></script>
<script src="/assets/js/misc/excanvas.min.js"></script>
<script src="/assets/js/jquery/facebox.js"></script>
<script src="/assets/js/jquery/jquery.visualize.js"></script>
<script src="/assets/js/jquery/jquery.dataTables.min.js"></script>
<script src="/assets/js/jquery/jquery.tablesorter.min.js"></script>
<script src="/assets/js/jquery/jquery.uniform.min.js"></script>
<script src="/assets/js/jquery/jquery.placeholder.min.js"></script>
<script src="/assets/js/widgets.js"></script>
<script src="/assets/js/dashboard.js"></script>
</head>
<body>
<script>
$("#formatted").datepicker({
dateFormat: $.datepicker.ISO_8601,
showOn: "both",
buttonImage: "http://pgoadmin.com/assets/images/calendar.gif",
buttonImageOnly: true
});
</script>
<form>
<input type="text" size="30" value="" id="formatted"/>
</form>
</body>
</html>
You need to load in jQuery UI to use the date picker
https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.js
Dont forget the images and CSS as well:
http://jqueryui.com/download
You need to include jquery before you start using it. Try moving the JS code below the jquery tag.
And as Wes says, you need to include jquery UI datepicker component as well.
Also, and this maybe a typo, your tag says "sricpt" instead of "script".
and don't forget to add base_url(); to your js paths
e.g.
<script src="<?php echo base_url(); ?>assets/js/dashboard.js"></script>