0

Table contains 2 columns. each column have form elements like text box and dropdown box. what i want is , when i click the row i have to call javascript function. My problem is, when i enter value in textbox or select value from dropdown that time also javascript function has called. How to prevent this. i dont want to fire the javascript function when entering text box and select the value from dropdown.

jQuery("#testParam tbody tr").on("click", function(event) {
        var position = paramTable.fnGetPosition(this); // getting the clicked row position
        //alert(position);
        createTable();
    });

function createTable(){
     alert("clicked");
}

<table id="testParam">
    <thead>
        <tr>
            <th class="no-sort">
                Name
            </th>

            <th class="no-sort">
                Type
            </th>
        </tr>
    </thead>
    <tbody>
        <tr id="paramRow1">

            <td><g:textField name="name1" id="name1" required="" value="${testName}" /></td>

            <td><g:select name="type1" noSelection="['':'-Select-']"
                    id="type1"
                    from="${testParameterInstance?.constraints?.type?.inList}"
                    required="" value="${testParameterInstance?.type}"
                    valueMessagePrefix="testParameter.type"  /></td>

        </tr>
    </tbody>
</table>

1 Answer 1

1

try this way

$('#name1,#type1').on('click',function(event){
    event.stopPropagation();
});

Happy Coding :)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.