Javascript: access server side variable client side using variable -
I'm trying to:
- JQuery on 'loop' through all the elements
- The page related to the same CSS class ("boilerplate")
- Check the current value of each on its server side value (property: static profil)
- Apply special CSS class ("Editedbackcolor") If two values do not match (i.e. I'm trying to flag, when the pref on a text box
CSS I am using:
.boilerplate = Assign all text boxes to form I
.editedbackcolor = Different shadows I want to assign to text boxes, where the current value is not equal
jQuery code I have so far:
jquery (document) .ready (function () {
// Select each element with the class boilerplate and the func Action Run jQuery ( '. Boilerplate input "). Each (function () {var target1 = jQuery (this) .attr ("i d"); matchcheck (target1);}); });
And I am working on the "matchcheck" function where I am having problems. I am trying to pull back the server side "static profile" property value which I can use As a comparison I am I have successfully told the control name to hardcoding, like:
function match check () {var TSP1 = '
;'; / / If the existing textbox value is not equal to a fixed prefilim value (document.getElementById ("Textbox1_textbox1"). Value! = TSP1) {Warning ("TB1 has differnt value compared to the stable prefilm"); // Change the background color to change it AddClass ("EditedBackColor");}} This works fine, but I do not use any variables through all the elements instead of loop The first row of the function is hardcoded in "Textbox1". I 'l & lt;% =' and '% & gt;' I have tried various syntax in an attempt to insert a variable between tags but this page will not be compiled when I try this.
Is it possible to use code behind some kind? Any suggestions?
If I understand your question, then there is an easy way to get bound in jQuery.
$ (document) .ready (function () (jQuery. ('. Boilerplate input'). Change (function () {if (jQuery (this) .val ()! == JQuery (this) .attr ("prefill") {jQuery (this) removeClass ('boilerplate') AddClass ("EditedBackColor");}})}};
It will also need to add an attribute called "prefil" to its input elements. Side that server side or client side should look something like this:
& lt; input class = "boilerplate" id = "Input1" type = "text" prefill = "123" value = "123" />
The warning here is that If they turn it into the original value, then it will still change. I am not sure that it works for you. Your scenario. They had changed it. You have to be saved as a basic value if it The second option is to send a model, maybe a Jason object, and compare that model on the basis of the index.
Comments
Post a Comment