|
|
|
สอบถามการเขียน jquery ให้แสดงค้าใน text box ใครพอจะมีตัวอย่างบ้างครับ |
|
|
|
|
|
|
|
Code (JavaScript)
<form class="form-inline" method="post" action="<?php echo $domain?>/product/">
<button type="submit" class="btn btn-default pull-right"><i class="glyphicon glyphicon-search"></i></button>
<input type="text" class="form-control pull-left" name="keyword" id="keyword" placeholder="Search">
</form>
<script>
$(document).ready( function(e){
$('#keyword').on('change', '', '', function(){ alert( $('#keyword').val() ); });
});
</script>
|
|
|
|
|
Date :
2014-08-15 14:08:47 |
By :
Chaidhanan |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขอบคุณครับ
|
|
|
|
|
Date :
2014-08-15 15:12:11 |
By :
keyword2015 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ลองแบบนี้ดูครับ
<style type="text/css">
#errorqoute{
display:none;
}
</style>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("button:submit").click(function(e){
e.preventDefault();
var action = $('form.form-inline').attr('action');
if($("#keyword").val()==''){
$('#errorqoute').text('you enter somethind').fadeIn('slow').fadeOut(5000);
$("#keyword").css('border','1px solid red').focus();
}else{
$('form.form-inline').attr('action',action+$("#keyword").val());
$('form.form-inline').submit();
}
});
});
</script>
<form class="form-inline" method="post" action="<?php echo $domain?>/product/">
<button type="submit" class="btn btn-default pull-right"><i class="glyphicon glyphicon-search"></i></button><input type="text" class="form-control pull-left" name="keyword" id="keyword" placeholder="Search"><span id='errorqoute'></span>
</form>
|
ประวัติการแก้ไข 2014-08-16 00:35:13
|
|
|
|
Date :
2014-08-16 00:32:53 |
By :
sakuraei |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|