locked
Set the value of textbox and hidden fields are both not working RRS feed

  • Question

  • User-973886032 posted

    hi guys
    this simple script is not working.

    Please help
    Everything works except lines 17 and 18 (even the alert works)

    html elements are

    <input type="hidden" name="cropx" id="cropx" value="0" />
    <input id="Text1" type="text" value="" />

    I have also tried replacing html with val e.g $('#cropx').val(c.x); 

    $(document).ready(function ($) {
            
            $('#Image1').Jcrop({
    
               
               bgColor: 'red',
                onSelect: function (c) {
                    $("#ehi").click(function () { //This is just a button ID
                       alert(c.x)
                    });
                    bgColor: 'red'
                    console.log(c.x);
                    console.log(c.y);
                    console.log(c.w);
                    console.log(c.h);
                    $('#cropx').html(c.x);
                    $('Text1').html('I am tired');
                   alert("Back of the net: Job done - " + c.x);

    Tuesday, February 27, 2018 10:58 PM

Answers

  • User-973886032 posted

    i cant seem to delete this,

    I found the error, I forgot to add the # identifier 

      $('Text1').html('I am tired');
      $('#Text1').html('I am tired');
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, February 27, 2018 11:12 PM