• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
javascript/css style

#1
i have javascriprt function that there is an id name and i need to call the value into html.   now it is possible to add the id name inside my html value, particular in input text value.

example.

i have id from javascript. #itismyidname
PHP Code:
$("#itismyidname").html('<img src="images/ajax-loader.gif" />'); 

here is what i want,
PHP Code:
<input type="text" size="20" name="code[]" value="<span id = 'itismyidname'></span> " /> 


if it is possible kindly advice..

 
Reply

#2
(12-14-2014, 07:23 PM)jaysondotp Wrote: i have javascriprt function that there is an id name and i need to call the value into html.   now it is possible to add the id name inside my html value, particular in input text value.

example.

i have id from javascript. #itismyidname

PHP Code:
$("#itismyidname").html('<img src="images/ajax-loader.gif" />'); 

here is what i want,

PHP Code:
<input type="text" size="20" name="code[]" value="<span id = 'itismyidname'></span> " /> 


if it is possible kindly advice..

 


I cant think of any reason to do this.
The ID should be the input ID tag as shown here:

PHP Code:
<input id="itismyidname" type="text" size="20" name="code[]" value="" /> 

And then you would set the value using the .val() in jQuery.

PHP Code:
$( "#itismyidname" ).valtext ); 

Also if you want the input field to go away and show the loading image you are attempting to put to it, you would have to wrap the input in a div with the id itismyidname and then toggle the html inside that div between an image and a input field.
Reply

#3
do you have any other sample. and here is my full JS code.


PHP Code:
<script type="text/javascript">
    $(
document).ready(function()
        {
            $(
"#text_val1").keyup(function (e) {
                $(
this).val($(this).val().replace(/\s/g''));
                var 
code = $(this).val();
                if(
code.length 4){$("#code_resul1").html('');return;}
                if(
code.length >= 4)
                    {
                        $(
"#code_resul1").valtext );
                        $.
post('check_input.php', {'code':code}, function(data) {
                        
 $("#code_resul1").html(data);
                        });
                    }
            });    
        });
</
script
and here is my html
PHP Code:
<input type="text" id "text_val1" size="20" name="code[]" value="" placeholder="Enter Arms" />
<
span id="code_resul1"></span

take a look my sample works, after typing integers.  if the record are existing, its provide details in a right side. and if its not, it will provide check image. but what i want is. the result details can show into another input in inside it not inthe outside.
[Image: Untitled_1.jpg]
[Image: Untitled_2.jpg]

kindly assist 
Reply

#4
Sample this is exactly what i want, but i need any sample that there is data comes from database. 
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.